回拨
application:didReceiveRemoteNotification:
只应在应用程序在前台运行时调用。当你在后台运行时,你应该给
application:didFinishLaunchingWithOptions:
.
既然你在问这个问题,同时也在使用核心位置,可能是
申请:DidReceiverEmotentification:
当应用程序在后台时调用,但我认为这是一个错误。至少根据苹果的文件。
无论如何,不,你不能阻止
applicationWillEnterForeground:
. 在不知道您在不同回调中具体做什么的情况下,我建议您在
应用程序将进入前台:
如果你在那里做了什么然后把那面旗签进去
- (void)applicationWillEnterForeground:(UIApplication *)application {
if (somehingHappend) {
somethingHappended = YES;
}
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
if (!somethingHappened) {
// push your view controllers or whatever
}
}
在哪里?
somethingHappened
是一个
BOOL
与ivar在同一类中定义。