2017-09-27 4 views
0

J'ai ajouté firebase dans mon projet objectif-C. Intégré avec succès, mais je ne peux pas afficher de notification dans la barre de notification de l'iPhone.didReceiveRemoteNotification n'a pas été appelée dans Firebase?

lorsque la notification est arrivée cette méthode est appelée et j'obtenir des données .. il

- (void)messaging:(FIRMessaging *)messaging didReceiveMessage:(FIRMessagingRemoteMessage *)remoteMessage { 

    NSLog(@"FCM Received data message: >> %@", [remoteMessage appData]); 


} 

Mais cette méthode n'a pas appelé ...

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 
    fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { 


    } 

Répondre

0

Êtes-vous sûr que votre charge utile contient notification clé comme ceci

{ 
    "to" : " ...", 
    "notification" : { 
     "body" : "great match!", 
     "title" : "Portugal vs. Denmark", 
     "icon" : "myicon" 
    }, 
    "data" : { 
     "Nick" : "Mario", 
     "Room" : "PortugalVSDenmark" 
    } 
    } 

Sans notification clé dans votre p La méthode ayload didRecieveRemoteNotification ne se déclenchera pas.

Vérifiez ces informations pour plus 12

+0

{ "collapse_key" = "id paquet"; à partir de 23123213; notification = { badge = 1; body = "le corps est là"; e = 1; icon = myicon; son = défaut; sound2 = "son defalut"; sous-titre = 1; title = "teasdfasasdf"; }; } –

+0

Quelle version d'iOS utilisez-vous? Si vous utilisez iOS 10.0 ou plus, consultez cette question https://stackoverflow.com/questions/39600914/push-notification-not-received-when-app-is-in-background-in-ios-10 – Himanth

+0

oui je suis en utilisant 11 mais il ne fonctionne toujours pas ... –