Mamy pewne problemy z funkcją powiadomień push w Firebase, ponieważ korzystamy z xCode 8 i OS 10. W naszej aplikacji poprosiliśmy użytkownika o włączenie powiadomienia push przy drugim uruchomieniu aplikacji, ale po 10 sekundach od pierwszego (i następne) uruchomienie, to wywala z tego dziennika:Powiadomienie push Firebase powoduje awarię
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'-[FIRInstanceIDConfig setAllowGCMRegistrationWithoutAPNSToken:]: unrecognized selector sent to instance 0x170207740'
również spróbować wyłączyć swizzling ale problem wystąpił ponownie.
Czy ktoś może nam powiedzieć, dokąd zmierzamy?
Firebase Kod 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
}
powiadomienia push zapytał:
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];
}
}
także mając ten problem. Czy wymyśliłeś rozwiązanie? – Tander