Push notification and launch application for Iphone4
I have an APNS enabled application. In Iphone4 when user press the HOME button application remains in cache. Now in this condition when a push notification received after clicking on the VIEW b开发者_StackOverflow中文版utton the application starts running from the cache!!!. I have found that it is invoking didReceiveRemoteNotification() and also the state of the application is UIApplicationStateActive rather than UIApplicationStateBackground
But in Iphone 3 it is working fine and invoking didLaunchingWithOptions().
What I want is when the application is not open(currently not running) , if a push notification received it will invoke the handler for push notification and launch the application from start.
any help or guidelines will be highly appriciated .
As far as I know, the application is in SUSPENDED state after tapping home button (after several transitions). So it is not executed (moreover it can be terminated in case system low memory warning).
Your possible solution is to set up the key "Application doesn't run in background" to imitate iOS3 behavior (in your .plist file).
Maybe this link will be useful for you: iOS 4 backgrounding
If your phone is connected to your MAC and you are debugging then that is the thing that cause your problem, so try disconnect your iphone and try again, that will solve the problem.
精彩评论