-2

At the moment in my app when a user exits to a UIWebView then comes back the app shows them a rating pop up. I do this in the if statement of my method.

- (void)viewWillDisappear
 {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];

 if  (self.appExitedToWebView) {
     [self.presentationController showAdvertsWithOfferID:self.offerDetailViewController.offer.offerID completionBlock:nil];
 }
}

However, I am wanting to only show the rating if the user has been on the UIWebView for over 15 minutes. How would I add this dependency on my method? I am guessing it is something to do with NSTimer?

Parth Adroja
  • 13,198
  • 5
  • 37
  • 71
Billy Boyo
  • 819
  • 2
  • 12
  • 22

2 Answers2

1

Call the start method when you show UIWebView and then after your mentioned time gets completed a method with be called timerFired and then you can set bool that user has completed your mentioned time.

-(void)start
{
    timer=[NSTimer scheduledTimerWithTimeInterval:yourtime target:self selector:@selector(timerFired) userInfo:nil repeats:YES];

}
-(void)timerFired

}
Parth Adroja
  • 13,198
  • 5
  • 37
  • 71
1

You can use this code

timer=[NSTimer scheduledTimerWithTimeInterval:yourtime target:self selector:@selector(showAlert) userInfo:nil repeats:NO];

-(void)showAlert {
   [timer invalidate];
   [self.presentationController showAdvertsWithOfferID:self.offerDetailViewController.offer.offerID completionBlock:nil];
}