我是在 iPhone 应用程序中使用 APNS 的新手。我在所有场景中都使用并收到了该消息。当user clicks the "View" button from the APNS alert i should do the actions in the app and navigate the user to 3rd tab
.
但是当应用程序处于In Active (The app not in use) 时 i can't trigger the actions in the app
。我在“didFinishLaunch”中使用了以下代码,但未使用。
NSString *params=[[launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"] objectForKey:@"aps"];
NSDictionary *remoteNotif = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
NSLog(@"remoteNotif : %@", remoteNotif);
if ([params length] > 0 )
{
UIAlertView *messageReceivedAlert = [[UIAlertView alloc] initWithTitle:@"My APP" message:@"New Message Recevied From APNS in IN-Active Stage" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[messageReceivedAlert show];
[messageReceivedAlert release];
}
它总是返回 (null)。
谁能帮我做到这一点?提前致谢。