uiapplicationdelegate

Conditionally start at different places in storyboard from AppDelegate

杀马特。学长 韩版系。学妹 提交于 2019-11-26 14:52:57
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 was successful or not if (success) { // 'push' main view controller } else { // 'push' login view

applicationWillEnterForeground vs. applicationDidBecomeActive, applicationWillResignActive vs. applicationDidEnterBackground

丶灬走出姿态 提交于 2019-11-26 14:48:08
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 applicationWillResignActive gets called when an incoming SMS or call comes in but the user chooses to click Ok and

Scheduled NSTimer when app is in background?

允我心安 提交于 2019-11-26 12:51:18
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 hour. Will it trigger for all the times that it missed, or will it wait till the next update time? What I

Local notification on application termination

▼魔方 西西 提交于 2019-11-26 12:47:15
问题 I am working on an application which will not work if terminated. It has some background tasks. I want to show a local notification if the app is terminated. There are applications which do this which means this is doable. But I am not able to find out a way. I have tried to set up a local notification in applicationWillTerminate: method of appdelegate as well as added a notification of app termination in my viewcontroller but none of the methods get called when app is actually terminated. -

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

一世执手 提交于 2019-11-26 11:34:47
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 background? shanegao See This code : - (void)application:(UIApplication *)application

What describes the Application Delegate best? How does it fit into the whole concept?

寵の児 提交于 2019-11-26 10:53:45
问题 I think to know what the App Delegate does. It has some nice methods like -applicationDidFinishLaunching which will be called when the app has finished launching, and so on. But what\'s that actually? Is that some object instantiated in the UIApplicationMain function? And how does it work that every class in my app has access to that App Delegate object? Is there any good graph on the net that visualizes these relationships? 回答1: In Cocoa, a delegate is an object that another object defers to

ApplicationWillTerminate in iOS 4.0

南笙酒味 提交于 2019-11-26 10:27:01
问题 The applicationWillTerminate delegate method is not getting called in iOS 4.0 When I hit the Home button I am seeing the applicationWillResignActive and applicationDidEnterBackground delegate methods getting called. - (void)applicationWillResignActive:(UIApplication *)application { NSLog(@\"Application Did Resign Active\"); } - (void)applicationDidEnterBackground:(UIApplication *)application { NSLog(@\"Application Did Enter Background\"); } And when I double Tap the Home button and again

What is a “delegate” in Objective C's iPhone development? [duplicate]

隐身守侯 提交于 2019-11-26 10:07:35
问题 This question already has an answer here: How do I create delegates in Objective-C? 19 answers What is a \"delegate\" in Objective C\'s iPhone development? 回答1: See this discussion A delegate allows one object to send messages to another object when an event happens. For example, if you're downloading data from a web site asynchronously using the NSURLConnection class. NSURLConnection has three common delegates: - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *

iPhone GPS in background never resumes after pause

旧城冷巷雨未停 提交于 2019-11-26 08:12:54
问题 My application needs to track user location changes in the background and works fine as long as user moves around. When user stops and CLLocationManager pauses after 10-20 minutes or so. It is indicated by this notification: -(void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager{} And this is also fine with me. Great, I save some battery, etc. The problem is that CLLocationManager never wakes up when user starts moving again and following delegate methods are never fired

Behaviour for significant change location API when terminated/suspended?

此生再无相见时 提交于 2019-11-26 06:10:58
问题 This is the section from the CLLocationManager documentation describing the app behavior with startMonitoringSignificantLocationChanges: If you start this service and your application is subsequently terminated, the system automatically relaunches the application into the background if a new event arrives. In such a case, the options dictionary passed to the application:didFinishLaunchingWithOptions: method of your application delegate contains the key UIApplicationLaunchOptionsLocationKey to