Mohamed Ezzat
Mohamed Ezzat

Reputation: 79

FIRMessagingDelegate's-messaging:didReceiveMessage: not implemented - Firebase 4.1.1 - Swift 3

I upgraded Firebase from v3 to v4 but I have some problems in receiving messages and I get this warning:

[Firebase/Messaging][I-FCM002019] FIRMessaging received data-message, but FIRMessagingDelegate's-messaging:didReceiveMessage: not implemented

I know I should implement this method :

public func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage){
    print(remoteMessage.appData)
            //let title = remoteMessage.appData[("data"): {"title"}]
           var title = "New Request"

            for value in remoteMessage.appData{
                if let value = value as?  [AnyHashable:Any]{
                print(value)
                }
            }
            let message = "okay"
            print(message)
             self.showAlertAppDelegate(title: title ,message:message ,buttonTitle:"ok",window:self.window!)
            print(title, message)

}

But I still have the warning so is there any actions should I do more ?

Upvotes: 1

Views: 4318

Answers (1)

Mohamed Ezzat
Mohamed Ezzat

Reputation: 79

I found the problem, which is I forgot this line

Messaging.messaging().delegate = self

in this method:

func application(_ application: UIApplication,
               didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {}

Upvotes: 7

Related Questions