2015-09-30 55 views
0

我面臨iOS的Google雲消息傳遞的一個奇怪問題。 該應用程序在調用僅在應用程序升級時Google雲消息傳遞崩潰

[[GGLContext sharedInstance] configureWithError:&configureError];

這種情況僅在Xcode中安裝一個新的應用程序與Google/CloudMessaging SDK在已經安裝了從App Store下載的應用程序的舊版本崩潰後幾秒鐘。

但是,如果我在全新安裝上運行它,一切都可以順利進行。

可能是墜機的原因是什麼?以及如何解決它?

// From Google GCM Sample app 
// https://github.com/googlesamples/google-services/blob/master/ios/gcm/GcmExample/AppDelegate.m 
- (void)configureGCM { 
    NSLog(@"Start ConfigureGCM"); 
    NSError* configureError; 
    [[GGLContext sharedInstance] configureWithError:&configureError]; 
    NSAssert(!configureError, @"Error configuring Google services: %@", configureError); 
    _gcmSenderID = [[[GGLContext sharedInstance] configuration] gcmSenderID]; 
    NSLog(@"gcmSenderID : %@, ConfigureError: %@", _gcmSenderID, configureError); 
    GCMConfig *gcmConfig = [GCMConfig defaultConfig]; 
    gcmConfig.receiverDelegate = self; 
    [[GCMService sharedInstance] startWithConfig:gcmConfig]; 

    __weak typeof(self) weakSelf = self; 

    _gcmRegistrationHandler = ^(NSString *registrationToken, NSError *error){ 
     if (registrationToken != nil) { 
      NSLog(@"GCM Registration Token: %@", registrationToken); 
      if(![weakSelf.user hasSyncedGCMToken]) { 
       [weakSelf.user syncGCMTokenWithServer:registrationToken]; 
      } 
     } else { 
      NSLog(@"Registration to GCM failed with error: %@", error.localizedDescription); 
     } 
    }; 
    NSLog(@"End ConfigureGCM"); 
} 

下面是日誌:

] Start ConfigureGCM 
] Successfully configured [CloudMessaging]. 
] Failed to configure []. 
] Subspecs not present, so not configured [Analytics, AdMob, SignIn, AppInvite, Maps]. 
] Subspecs expected to be present [CloudMessaging, Measurement]. 
] <GMR/INFO> App measurement v.1100000 started 
] <GMR/ERROR> Exception on worker queue: data parameter is nil 
] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil' 
*** First throw call stack: 
(0x30cb3e83 0x3b0106c7 0x30cb3dc5 0x315f127f 0x122b73 0x1222ad 0x123bcb 0x129d9f 0x3b4f50c3 0x3b4f9e7b 0x3b4f6f93 0x3b4fa745 0x3b4fa9c5 0x3b624dff 0x3b624cc4) 
libc++abi.dylib: terminating with uncaught exception of type NSException 

這裏是堆棧跟蹤的截圖 enter image description here

enter image description here

更新

這個問題似乎並沒有被髮生在iOS上8或以上。 對我來說,墜機是在iPhone 5與iOS 7.0.4

更新-2

現在,我使用推送通知僅適用於iOS 8+用戶。還在等待谷歌的答覆on Github

更新-3

在GCM的最新版本修正

+0

谷歌表示,他們在這個固定問題:https://github.com/google/gcm/issues/124 – user102008

+0

@ user102008謝謝。更新。 – ntsh

回答

0

更新

這個問題一直fixed通過GCM

相關問題