cordova-plugin-fcm-with-dependecy-updated
cordova-plugin-fcm-with-dependecy-updated copied to clipboard
$HOME/Documents/ionic_projects/project/platforms/ios/Project/Plugins/cordova-plugin-fcm-with-dependecy-updated/AppDelegate+FCMPlugin.m:146:101: Nullability specifier 'nonnull' conflicts with existing specifier 'nullable'
Describe the bug
Once build failed on Xcode (made first on VSCode), it gives this error and 4 warnings.
Using Ionic 5, works perfectly on Android, just need to fix this error for iOS, thank you so much
To Reproduce
Steps to reproduce the behavior:
Existing project working perfectly on Android, making build for the first time for iOS
2. Click on '....'
3. Scroll down to '....'
ERROR:
- (void)messaging:(nonnull FIRMessaging *)messaging didReceiveRegistrationToken:(nonnull NSString *)deviceToken { NSLog(@"Device FCM Token: %@", deviceToken); if(deviceToken == nil) { fcmToken = nil; [FCMPlugin.fcmPlugin notifyFCMTokenRefresh:nil]; return; } // Notify about received token. NSDictionary *dataDict = [NSDictionary dictionaryWithObject:deviceToken forKey:@"token"]; [[NSNotificationCenter defaultCenter] postNotificationName:@"FCMToken" object:nil userInfo:dataDict]; fcmToken = deviceToken; [FCMPlugin.fcmPlugin notifyFCMTokenRefresh:deviceToken]; [self connectToFcm]; }
Expected behavior
Should compile (I think so)
Screenshots
Environment (please complete the following information):
- Developer OS and version: MacOS Big Sur
- Mobile OS and version:
- Cordova CLI version (cordova --version): 10
- Cocoapods version (pod --version): 1.10.1
- Xcode version (xcodebuild -version): 12.4
Package.json
{
"name": "app",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~10.0.0",
"@angular/core": "~10.0.0",
"@angular/fire": "^6.0.3",
"@angular/forms": "~10.0.0",
"@angular/platform-browser": "~10.0.0",
"@angular/platform-browser-dynamic": "~10.0.0",
"@angular/router": "~10.0.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/email-composer": "^5.30.0",
"@ionic-native/fcm": "^5.29.0",
"@ionic-native/in-app-browser": "^5.30.0",
"@ionic-native/local-notifications": "^5.29.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic-super-tabs/angular": "^7.0.8",
"@ionic/angular": "^5.0.0",
"@ionic/storage": "^2.3.1",
"firebase": "^7.24.0",
"rxjs": "~6.5.5",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1002.0",
"@angular/cli": "~10.0.5",
"@angular/compiler": "~10.0.0",
"@angular/compiler-cli": "~10.0.0",
"@angular/language-service": "~10.0.0",
"@ionic/angular-toolkit": "^2.3.0",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"cordova-android": "^9.0.0",
"cordova-ios": "^6.1.1",
"cordova-plugin-androidx": "^3.0.0",
"cordova-plugin-androidx-adapter": "^1.1.1",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-email-composer": "^0.9.2",
"cordova-plugin-fcm-with-dependecy-updated": "^7.3.1",
"cordova-plugin-inappbrowser": "^4.1.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.2.1",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-sqlite-storage": "^5.1.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.9.5"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-fcm-with-dependecy-updated": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-local-notification": {},
"cordova-sqlite-storage": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-email-composer": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
}
},
"platforms": [
"android",
"ios"
]
}
}
ERROR in Terminal
Objects-normal/x86_64/AppDelegate+FCMPlugin.o
/Users/manel/Documents/ionic_projects/topstock/platforms/ios/TopStockAlerts/Plugins/cordova-plugin-fcm-with-dependecy-updated/AppDelegate+FCMPlugin.m:146:101: error:
nullability specifier 'nonnull' conflicts with existing specifier 'nullable'
- (void)messaging:(nonnull FIRMessaging *)messaging didReceiveRegistrationToken:(nonnull NSString *)deviceToken {
https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated/commit/be75cce2930b4a9af61df7df85db249dea705f9a maybe this can be the solution? how to apply it? thank you
Hi Manel. change "didReceiveRegistrationToken:(nonnull NSString *)deviceToken" to "didReceiveRegistrationToken:(NSString *)deviceToken" in the library source ios AppDelegate+FCMPlugin.m.
i had the same issue and remove nonnull fixed my issue in xcode library source ios AppDelegate+FCMPlugin.m file
