uiapplicationdelegate

Handling applicationDidBecomeActive - “How can a view controller respond to the app becoming Active?”

限于喜欢 提交于 2019-11-26 06:08:46
I have the UIApplicationDelegate protocol in my main AppDelegate.m class, with the applicationDidBecomeActive method defined. I want to call a method when the application returns from the background, but the method is in another view controller. How can I check which view controller is currently showing in the applicationDidBecomeActive method and then make a call to a method within that controller? Reed Olsen Any class in your application can become an "observer" for different notifications in the application. When you create (or load) your view controller, you'll want to register it as an

Conditionally start at different places in storyboard from AppDelegate

青春壹個敷衍的年華 提交于 2019-11-26 04:05:39
问题 I have a storyboard set up with working login and main view controller, the latter is the view controller to which the user is navigated to when login is successful. My objective is to show the main view controller immediately if the authentication (stored in keychain) is successful, and show the login view controller if the authentication failed. Basically, I want to do this in my AppDelegate: // url request & response work fine, assume success is a BOOL here // that indicates whether login

applicationWillEnterForeground vs. applicationDidBecomeActive, applicationWillResignActive vs. applicationDidEnterBackground

孤者浪人 提交于 2019-11-26 04:01:50
问题 Which is the proper delegate to implement when an application is waking up from being in the background and you want it to prep it to be active? applicationWillEnterForeground vs applicationDidBecomeActive -- What\'s the difference? Which is the proper delegate to implement for when an application is going to sleep and you want to prep it to cleanup and save data? applicationWillResignActive vs. applicationDidEnterBackground -- What\'s the difference? Also, I\'ve noticed that

Handling applicationDidBecomeActive - “How can a view controller respond to the app becoming Active?”

痞子三分冷 提交于 2019-11-26 03:25:05
问题 I have the UIApplicationDelegate protocol in my main AppDelegate.m class, with the applicationDidBecomeActive method defined. I want to call a method when the application returns from the background, but the method is in another view controller. How can I check which view controller is currently showing in the applicationDidBecomeActive method and then make a call to a method within that controller? 回答1: Any class in your application can become an "observer" for different notifications in the

Scheduled NSTimer when app is in background?

∥☆過路亽.° 提交于 2019-11-26 03:07:43
问题 How do people deal with a scheduled NSTimer when an app is in the background? Let\'s say I update something in my app every hour. updateTimer = [NSTimer scheduledTimerWithTimeInterval:60.0*60.0 target:self selector:@selector(updateStuff) userInfo:nil repeats:YES]; When in the background, this timer obviously doesn\'t fire(?). What should happen when the user comes back to the app..? Is the timer still running, with the same times? And what would would happen if the user comes back in over an

Detect if the app was launched/opened from a push notification

試著忘記壹切 提交于 2019-11-26 02:28:30
问题 Is it possible to know if the app was launched/opened from a push notification? I guess the launching event can be caught here: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if (launchOptions != nil) { // Launched from push notification NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; } } However, how can I detect it was opened from a push notification when the app was in