Hello, I’m using Apple APNS to send RemoteNotification. The problems that I found are:
First of all, I want to receive RemoteNotification and then jump other page, not the main page (first page)my code:
- (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;
}
My app enter background and is not killed by the system, when receive RemoteNotification and click it, my code is OK, it can Jump other view. But when killed my app, when i receive the RemoteNotification, I click it, it not skip other view, it only enter the main view, how to solve it.
Moreover, when I cancel the LocalNotification I can use [[UIApplication sharedApplication] cancelLocalNotification:notification]; but at RemoteNotification i can not find the same methods. How can I do it?
i can answer my question 1:
for question 2,sometime it can cancel itself,sometime not