2017-01-31 6 views
2

Ich habe Firebase-Push-Benachrichtigungen in meiner App integriert. Benachrichtigungen sind in xcode aktiviert. Zertifikate sind auch in Ordnung. Benachrichtigungen werden in meiner App nicht angezeigt. Hat jemand eine Ahnung davon?Firebase-Benachrichtigungen funktionieren nicht ios

Hier ist mein Code:

[FIRApp configure]; 

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 
#if defined(__IPHONE_10_0) && IPHONE_OS_VERSION_MAX_ALLOWED >= IPHONE_10_0 
    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]; 
#endif 
    } 

[[UIApplication sharedApplication] registerForRemoteNotifications]; 

Antwort

2

Ausgabe verursacht werden können, wenn Sie nicht die richtige SDKs setzen Sie. Vergewissern Sie sich, diese beiden:

'Firebase/Kern' und 'Firebase/Messaging'

+1

Ohh i fehlte Feuerbasis/Messaging in meinem Projekt. Es sollte eine Fehlermeldung angezeigt werden. Danke vielmals. – thomasadolf

Verwandte Themen