您好,我正在使用Apple APNS發送RemoteNotification。我發現的問題是:當收到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中我找不到相同的方法。我該怎麼做?
你可以看到我的代碼我也做到了 – pengwang