Im creating an Ionic 6.0 Cordova 9.0 project and I'm attempting to add the cordova fcm plugin in addition to the Cordova iOS 5.1.1 but it's failing in the build.
Here is my package json
"cordova": "^8.0.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-ios": "^5.1.1",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-fcm-with-dependecy-updated": "^7.3.0",
what's odd is Cordova says 8.0.0 which is really
cordova -v
9.0.0 ([email protected])
But the real problem is attempting to build the iOS project
** BUILD FAILED **
The following build commands failed:
CompileC /var/root/Library/Developer/Xcode/DerivedData/-fzuncmihunbgyyfsixovlktiuyaf/Build/Intermediates.noindex/app.build/Debug-iphonesimulator/app\ Mingle.build/Objects-normal/x86_64/AppDelegate+FCMPlugin.o /Users/anonymous/project/app-v5/platforms/ios/Heathen\ Mingle/Plugins/cordova-plugin-fcm-with-dependecy-updated/AppDelegate+FCMPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
and then when I attempt to open in xCode I get a similar error in this specific line of code:
- (void)messaging:(nonnull FIRMessaging *)messaging didReceiveRegistrationToken:(nonnull NSString *)deviceToken {
NSLog(@"Device FCM Token: %@", deviceToken);
if(deviceToken == nil) {
fcmToken = nil;
[FCMPlugin.fcmPlugin notifyFCMTokenRefresh:nil];
return;
}
Nullability specifier 'nonnull' conflicts with existing specifier 'nullable'
I don't have an issue with Android, only with iOS and this conflict.
EDIT: As a hot fix, you can delete "nonnull" keyword in the "- (void)messaging:(nonnull FIRMessaging *)messaging didReceiveRegistrationToken:(nonnull NSString *)deviceToken {" error statement. This helped me succeed in building the app.
I followed these steps for a successful build:
Now Delete plugins folder, platforms folder and the node_modules folder. (Step 6, 7 and 8)
( I know I couldve just said I updated pod repo and re installed node modules, plugins and platform but alot of new devs might have wasted some more time figuring out these commands, so yeah! )