不,你不能改变任何关于系统处理推送通知程序的方式。
只有滑块被用户使用时,才会打开您的应用程序。您可以通过- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
的本地通知检查您的应用程序是否已打开。只需检查是否有通知。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
[self.window addSubview:self.tabBarController.view];
[self.window makeKeyAndVisible];
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (notification) {
[self performSelector:@selector(handleNotification:) withObject:notification afterDelay:0.1];
}
return YES;
}
// Recieved notification when running
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[self handleNotification:notification];
}
- (void) handleNotification:(UILocalNotification *)notification {
// Handle the notification
}
但我有一个应用程序已经在运行,所以我不认为这种方法是非常有帮助 - 我的意思是:我启动应用程序,那么一段时间后发送其首次触发两个通知滑块阅读和阅读 - 但!我想读取和解锁 – raistlin 2012-01-05 13:24:19
当接收到通知后屏幕开启时,“解锁”滑块就是“读取”。并且在回到睡眠之后将再次读取“解锁”。没有什么可以改变的,这就是系统的工作原理。 – rckoenes 2012-01-05 14:09:15
thx,它有很大的帮助:)我可以接受你的最后评论作为正确答案,或者我应该接受整个答案吗? – raistlin 2012-01-05 14:41:08