Search code examples
iosiphoneuilocalnotificationappdelegate

Application does not enter into application didfinishlaunchingwith option after user push home button


I am developing an app which makes use of the UILocalNotification to do the scheduling task. There is a class which handles the scheduling task and its function is called from both applicationdidfinishwithlaunchingoption and didReceiveLocalNotification to handle the task for both active and not active state. I set the key of "Application does not run in background" to YES in my plist file.

My user schedule the task and then click on homebutton. When they see a banner of UILOcalNotification and they click on it, neither didfinishlaunchingwithoption is fired nor didReceiveLocalNotification is fired. I tried setting "Application does not run in background" to No and they check for the handing the task and it works good in that mode however I do not want to be in this mode cause I heard Apple reject some app due to background running if they do not do any relevant task like VOIP or so.


Solution

  • I think the didfinishlaunchingwithoption method should fired but you can't see it in debug mode. I have an Alarm app and i also set Application does not run in background to yes , i faced this situation a lot.

    So, my suggestion is edit the Scheme and switch the launch option to wait for app to launch manually. and debug to see if it's fired.enter image description here