ios - NSRunLoop for showing UIAlertView when iPad is in sleep mode -


I have a strange situation, click on a button at the event I add the timer for the NSRon loop which is 'X' Should fire after minutes. But if the 'x' sleeps before the 'x' minute and the value of that timer reaches 'x' value and after that I open my app again it does not show a warning

so If the timer has expired and the iPad is in sleep mode then I should show this a warning after starting the app again. Below is my code

  NSTimer * uiTimer = [NSTimer TimerWith TimeTime: [x IntuView] * 60 Target: Self Selector: @Sillector (Fire Administration) User Information: Zero Repeats: No]; [[NSRunLoop mainRunLoop] addTimer: uiTimer forMode: NSRunLoopCommonModes]; - (Zero) Firethumb {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "Headline" Message: @ "Message" Representative: Cancel YourTutton Title: Zero Other Binittits: @ "OK", Zero]; [Alerts show]; }  

Maybe you can change your logic a bit? In your app's applicationDidEnterBackground: , you can invalidate your timer, and save the current time. After this, the app Williamforeland: , you can get the current time, and if the time difference is more than the required interval, display the alert.


Comments