2012-07-04 27 views
0

我第一次玩APNS,我嘗試運行一個iOS 5.0.1設備的概念驗證,並且didFailToRegisterForRemoteNotificationsWithError被解僱。我知道它已經被解僱了,因爲我表現出UIAlertView通知錯誤:didFailToRegisterForRemoteNotificationsWithError被觸發,如何獲取更多信息?

- (void)application:(UIApplication*)application 
    didFailToRegisterForRemoteNotificationsWithError:(NSError*)error 
{ 
    // Inform the user that registration failed 
    NSString* failureMessage = @"There was an error while trying to \ 

    register for push notifications."; 

    UIAlertView* failureAlert = [[UIAlertView alloc] initWithTitle:@"Error" 
                 message:failureMessage 
                delegate:nil 
              cancelButtonTitle:@"OK" 
              otherButtonTitles:nil]; 

    [failureAlert show]; 
    [failureAlert release]; 
} 

我如何獲得有關錯誤的詳細信息?

回答

0

我結束了這段代碼,它的工作原理,讓我進步了一下:

NSString* failureMessage = error.localizedDescription;  
UIAlertView* failureAlert = [[UIAlertView alloc] initWithTitle:@"Error" 
               message:failureMessage 
               delegate:nil 
               cancelButtonTitle:@"OK" 
               otherButtonTitles:nil]; 
[failureAlert show]; 

對不起,iObjectiveC小白在這裏。

0

試着做一些像NSLog(@"%@", error.userInfo");這應該輸出一些信息到終端。

相關問題