1

beginBackgroundTaskWithExpirationHandler按下主页按钮后,我将我的应用程序置于后台约 10 分钟(使用)。在 10 分钟结束时,我正在设置一个本地通知以再次将我的应用程序启动到同一个视图控制器。

但是当我与本地通知交互时,我无法进入同一个视图控制器。它被称为applicationWillEnterForeground然后didReceiveLocalNotification。在didReceiveLocalNotification我设置我的视图控制器但没有成功。

编辑

代码在didReceiveLocalNotification

NF1AbcController *aBC = [[NF1AbcController alloc]init]; 
[self.navigationManager.defaultNavigationController pushViewController:aBC animated:YES];
4

1 回答 1

0

you have to make sure that your aBC view controller is not nill, also check that defaultNavigationController is not nil.

the appropriate way to do such thing is send a notification of type NSNotifcation inside the applicationDidRevieveLocalNotification method

also you will have to register the last view controller that was visible before the app entered the background ,when your view controller receives the notification is pushes your desired view controller

more on this in apple Notification Programming guide

于 2013-03-18T10:49:49.063 回答