一旦一个进程完成,我就会发送一个本地通知,它运行良好。
这是我的didReceiveLocalNotification代码:
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
CounterViewController *counterVC = [CounterViewController sharedInstance];
[counterVC notificationArrived];
}但是,当iPhone被锁定时,这些行不会被称为…我该怎么做才能让它们在后台运行?
发布于 2013-03-19 18:55:38
有两种方法来接收本地通知,一种是你已经实现的,它在应用程序运行时调用;第二种是在didFinishLaunchingWithOptions中,它在你的应用程序运行时被调用,你已经添加了一些代码来接收本地通知.....
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
application.applicationIconBadgeNumber = 0;
// Handle launching from a notification
UILocalNotification *localNotif =
[launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotif) {
NSLog(@"Recieved Notification %@",localNotif);
}
return YES;}
https://stackoverflow.com/questions/15493154
复制相似问题