8

我們,因爲我們使用的Xcode 8和OS 10.在我們的應用有一定的麻煩與火力地堡推送通知功能,我們要求用戶啓用的第二次發射應用的推送通知,但第一後10秒後(和下一個)啓動,它與此日誌崩潰:推送通知火力地堡導致崩潰

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 
'-[FIRInstanceIDConfig setAllowGCMRegistrationWithoutAPNSToken:]: unrecognized selector sent to instance 0x170207740' 

我們也嘗試禁用swizzling,但問題再次發生。

誰能告訴我們,我們要去的地方錯了?

火力地堡的AppDelegate代碼:

#pragma mark - Notification 
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
    UALog(@"success to register notification"); 
#ifdef DEBUG 
    [[FIRInstanceID instanceID] setAPNSToken:deviceToken 
             type:FIRInstanceIDAPNSTokenTypeSandbox]; 
#else 
    [[FIRInstanceID instanceID] setAPNSToken:deviceToken 
             type:FIRInstanceIDAPNSTokenTypeProduction]; 
#endif 
} 

推送通知要求:

if ([popUpViewController isKindOfClass:[GSPushNotificationsPopupViewController class]]) { 
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:NSUD_ALREADY_DISPLAYED_NOTIF_MESSAGE]; 
    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) { 
     UIUserNotificationType allNotificationTypes = (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge); 
     UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil]; 
     [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; 
    } else { 
     // iOS 10 or later 
     UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge; 
     [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions completionHandler:^(BOOL granted, NSError * _Nullable error) { 

     }]; 

     // For iOS 10 display notification (sent via APNS) 
     [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self]; 
     // For iOS 10 data message (sent via FCM) 
     [[FIRMessaging messaging] setRemoteMessageDelegate:self]; 
    } 
} 
+0

也有這個問題。你有沒有想出解決方案? – Tander

回答

1

您已經添加了您的應用程序的其他連接標誌來-ObjC?您可以通過點擊做到這一點:項目名稱 - >構建設置 - >其它鏈接器標記

enter image description here