您好,我正在使用 Apple APNS 发送 RemoteNotification。我发现的问题是:
首先,我想接收RemoteNotification然后跳转其他页面,而不是主页(第一页)我的代码:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"remote notification: %@",[userInfo description]);
NSDictionary *apsInfo = [userInfo objectForKey:@"aps"];
NSString *alert = [apsInfo objectForKey:@"alert"];
NSLog(@"Received Push Alert: %@", alert);
NSString *sound = [apsInfo objectForKey:@"sound"];
NSLog(@"Received Push Sound: %@", sound);
NSString *badge = [apsInfo objectForKey:@"badge"];
NSLog(@"Received Push Badge: %@", badge);
application.applicationIconBadgeNumber = [[apsInfo objectForKey:@"badge"] integerValue];
if ([userInfo objectForKey:@"type"])
{
NSString *nsType = [userInfo objectForKey:@"type"];
NSLog(@"Received Push nsType: %@", nsType);
if([[userInfo objectForKey:@"type"] intValue]==1){//chat
[self JumpChatHistoryView];
}else{
[self JumpMessageDetailView];
}
}
application.applicationIconBadgeNumber = 0;
}
我的应用程序进入后台并且没有被系统杀死,当收到RemoteNotification并点击它时,我的代码是OK的,它可以跳转其他视图。但是当我杀死我的应用程序时,当我收到RemoteNotification时,我点击它,它没有跳过其他视图,它只进入主视图,如何解决它。
此外,当我取消 LocalNotification 我可以使用[[UIApplication sharedApplication] cancelLocalNotification:notification];
但在 RemoteNotification 我找不到相同的方法。我该怎么做?