2012-03-19 29 views
1

我正在使用Urban Airship圖書館實施推送通知。我能夠接收來自測試推送通知的推送通知。現在,當我點擊推送通知提醒的查看即操作按鈕時,我的應用程序將啓動,但無法在didFinishLaunchingWithOption和applicationDidBecomeActive中獲取回調。以下是我在我的didFinishLaunchingWithOption到目前爲止做,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是沒有得到調用。 AM我錯過了任何東西?另外,我想在u查看通知時顯示自己的ui。

請指導我如果我缺少任何東西。還有一些樣本,鏈接可能會有所幫助。 在此先感謝...

回答

2

也許應用程序已經啓動?您還需要實現:

application:didReceiveRemoteNotification: 

在那裏你會得到即使該應用程序已經啓動的通知。

+0

感謝的人....當應用程序已經啓動,這是被調用..也didFinishLaunchingWithOptions被調用的行動按鈕。我加入警報對話框和運行應用程序,並得到它得到回調時...謝謝解決.. – Panache 2012-03-20 10:18:05