我已经使用Urban Airship实施了苹果推送通知服务,并在我的应用程序中成功收到通知。如果我收到警报视图的通知,如果我在警报视图中单击视图按钮,它将启动应用程序。通常它发生在APNS中。但是我的客户想要的是,如果在RSS提要和警报视图中发生任何更新,如果我们在警报视图中单击视图,它应该转到应用程序中的特定提要,不会启动应用程序。这样做有可能吗?是否有可能为我的应用程序中的特定警报视图按钮编写事件。在iPhone中使用城市飞艇的苹果推送通知服务
这里我的示例代码,
- (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,我不能得到的字典中的值,它总是空值。是否有可能在此方法中获取字典值(Notification)。
- (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];
}
在这种方法中,我可以得到字典值。但是,如果在应用程序中运行时发生更新,则此方法只会调用。
请指导我!
谢谢
+1,@robotadam,比ks的答复。看到我更新的问题,请提到我做错了什么。谢谢。 – Pugal 2010-08-14 10:23:45
我不确定你现在的问题是什么 - 你有来自推送通知的数据,是的?剩下的看起来像是一个钩入你的代码的其余部分。 – robotadam 2010-08-14 15:12:28
@robotadam - 我想他是说应用程序:didReceiveRemoteNotification只是在应用程序在前台进行通知时才被调用。 – 2010-08-15 04:17:14