ios - How may I trigger banner notifications using FCM? -
how show banners in app using firebase's fcm feature? able receive , show banner notifications via apple provided delegate method:
func usernotificationcenter(_ center: unusernotificationcenter, willpresent notification: unnotification, withcompletionhandler completionhandler: @escaping (unnotificationpresentationoptions) -> void) { completionhandler([.alert, .badge, .sound]) }
however, once try use fcm, method no longer called. instead, it's method receives notification information:
extension firebasenotificationmanager: firmessagingdelegate { func applicationreceivedremotemessage(_ remotemessage: firmessagingremotemessage) { let appdata = remotemessage.appdata appdata.foreach { print($0) } } }
i can printout of appdata
, i'm not sure how display banner alert.
any appreciated!
i using ios 10 , working me.
- (void)usernotificationcenter:(unusernotificationcenter *)center willpresentnotification:(unnotification *)notification withcompletionhandler:(void (^)(unnotificationpresentationoptions))completionhandler { nsdictionary *userinfo = notification.request.content.userinfo; // print full message. nslog(@"%@", userinfo); // change preferred presentation option completionhandler(unnotificationpresentationoptionalert); }
Comments
Post a Comment