Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find protocol declaration 'FIRMessagingDelegate'

I'm trying to add Firebase Messaging to my iOS app. I've followed the steps in the Firebase documentation, namely:

  • Uploaded the APNs Certificate
  • Imported Firebase and added [FIRApp configure]
  • Imported Firebase Messaging with @import FirebaseMessaging and added FIRMessagingDelegate

However at this point I get an error:

@interface AppDelegate () <UNUserNotificationCenterDelegate, FIRMessagingDelegate>      
// Cannot find protocol declaration for FIRMessagingDelegate

I've updated my pods (suggested by similar issues found on Stack Overflow), but still get the same error. To confirm, running pod update gives the following output:

 Using FirebaseMessaging (1.2.2)

Any suggestions?

like image 361
user2181948 Avatar asked Feb 19 '17 23:02

user2181948


2 Answers

The issue seems to be that the FIRMessagingDelegate protocol is declared in the new FirebaseMessaging framework.

Simply add:

@import FirebaseMessaging;

See more at: https://firebase.google.com/docs/reference/ios/firebasemessaging/api/reference/Protocols/FIRMessagingDelegate

and the sample app AppDelegate.m here: https://github.com/firebase/quickstart-ios/blob/master/messaging/MessagingExample/AppDelegate.m#L62-L85

like image 60
Roger Avatar answered Sep 17 '22 11:09

Roger


I found this useful in the pod file:

pod 'Firebase/Messaging'
to
pod 'Firebase/Messaging', '~> 4.0.0'

Now all dependencies are found.

like image 26
htafoya Avatar answered Sep 20 '22 11:09

htafoya