【发布时间】:2012-04-04 04:35:39
【问题描述】:
我正在使用 Urban Airship 库实现推送通知。我能够从测试推送通知接收推送通知。现在,当我单击查看,即推送通知警报的操作按钮时,我的应用程序启动但也无法在 didFinishLaunchingWithOption 和 applicationDidBecomeActive 中获得回调。到目前为止,这是我在 didFinishLaunchingWithOption 中所做的,
// Check if App running in Simulator.
[self failIfSimulator];
NSDictionary *remoteNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (remoteNotification != nil) {
NSString *message = [remoteNotification descriptionWithLocale:nil indent: 1];
NSLog(@"Message in didFinishLaunchingWithOptions: %@",message);
}
//Init Airship launch options
NSMutableDictionary *takeOffOptions = [[[NSMutableDictionary alloc] init] autorelease];
[takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];
// Create Airship singleton that's used to talk to Urban Airship servers.
// Please populate AirshipConfig.plist with your info from http://go.urbanairship.com
[UAirship takeOff:takeOffOptions];
// Register for notifications
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)];
现在,当我使用测试推送收到任何通知并单击查看按钮时,我的应用程序将启动,但没有调用 didFinishLaunchingWithOption。我错过了什么吗?另外,当你查看通知时,我想显示我自己的用户界面。
如果我缺少任何东西,请指导我。还有一些示例,链接可能会有所帮助。 提前谢谢...
【问题讨论】:
标签: iphone push-notification urbanairship.com