我已经使用城市飞艇实现了苹果推送通知服务,并在我的应用程序中成功地收到了通知。如果我收到警报视图发出的通知,如果我在警报视图中单击视图按钮,它将启动应用程序。一般发生在APNS。但是我的客户希望,如果在RSS提要中发生了任何更新并且出现了警报视图,如果我们在警报视图中单击视图,它应该转到应用程序中的特定提要,而不是启动应用程序。那有可能吗?。可以为我的应用程序中的特定警报视图按钮编写事件。
我的示例代码是,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
[window addSubview:viewcontrollers.view];
[window makeKeyAndVisible];
NSLog(@"remote notification2: %@",[launchOptions description]);
return YES;
}
在这个didFinishLaunchingWithOptions方法中,我无法获取字典值,它总是获取空值。在这个方法中有任何可能获得字典值(通知来了)。
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
NSString *message = [userInfo descriptionWithLocale:nil indent: 1];
NSLog(@"The message string is %@",message);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Remote Notification" message: message delegate: nil cancelButtonTitle: @"ok" otherButtonTitles: nil];
[alert show];
[alert release];
}
在这个方法中,我可以得到字典的值。但此方法仅在应用程序中运行时发生任何更新时调用。
请引导我!
谢谢