Reputation:
I'm working with some Swift and FCM code and after updating pods I'm getting two errors. I have done research but can't figure out what to do to fix it.
Here is the code:
// For iOS 10 display notification (sent via APNS)
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
// For iOS 10 data message (sent via FCM)
[FIRMessaging messaging].remoteMessageDelegate = self;
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeProd]; error message———> No visible @interface for 'FIRInstanceID' declares the selector 'setAPNSToken:type:'<--error message ends
NSLog(@"deviceToken1 = %@; %@",deviceToken,[[FIRInstanceID instanceID] token]);
}
Here is the error message:
Property 'remoteMessageDelegate' not found on object of type 'FIRMessaging *'
Upvotes: 4
Views: 7254
Reputation: 29590
In version 5.0.0, they removed remoteMessageDelegate
and replaced it with delegate
:
https://firebase.google.com/support/release-notes/ios#5.0.0
It is also delegate
now in the current FIRMessaging
API documentation:
https://firebase.google.com/docs/reference/ios/firebasemessaging/api/reference/Classes/FIRMessaging#/c:objc(cs)FIRMessaging(py)delegate
Delegate to handle FCM token refreshes, and remote data messages received via FCM direct channel.
@property (readwrite, nonatomic, nullable) id<FIRMessagingDelegate>
delegate;
You can refer to their quickstart-ios code for sample usage:
https://github.com/firebase/quickstart-ios/blob/master/messaging/MessagingExample/AppDelegate.m#L36
// [START set_messaging_delegate]
[FIRMessaging messaging].delegate = self;
// [END set_messaging_delegate]
Upvotes: 6