Reputation: 718
after updating Pod library getting above error in appdelegate.m
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
[[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeSandbox];
NSString *newToken = [deviceToken description];
newToken = [newToken stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
newToken = [newToken stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"My token is: %@", newToken);
}
Upvotes: 5
Views: 10029
Reputation: 71
You probably have an old version of firebase_messaging
in your pubspec.yaml
. Make sure you have the latest version. If this does not help, go to the ios folder (cd ios/
), then run pod update
, and then flutter clean
. Then, run your app again.
Upvotes: 1
Reputation: 876
Alternative solutions: Probably it is a problem with latest firebase version (v6). Change firebase version in Podfile. add below line to Podfile
pod 'Firebase/Core', '~>5.20.2'
Then run pod update
This help me fixed problem
Upvotes: 0
Reputation: 2916
It is deprecated code, you should try with the FIRMessaging
You can update your code to look like this
// With "FirebaseAppDelegateProxyEnabled": NO
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[FIRMessaging messaging].APNSToken = deviceToken;
}
Refer here for more details.
Upvotes: 7