Ionic 3 - your app contains non-public api usage - ios

i have a ionic 3 app that works with emulator android ios and it is publish on google store but when i tryed to upload on apple store it give me back "your app contains non-public api usage"
I'm trying to check all plugin list that may have caused the problem; different from an app I published several days ago are:
barcodescanner
call-number
email-composer
geolocation
leaflet
this is my package.json:
{
"name": "Nome App",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint"
},
"dependencies": {
"#angular/animations": "5.2.11",
"#angular/common": "5.2.11",
"#angular/compiler": "5.2.11",
"#angular/compiler-cli": "5.2.11",
"#angular/core": "5.2.11",
"#angular/forms": "5.2.11",
"#angular/http": "5.2.11",
"#angular/platform-browser": "5.2.11",
"#angular/platform-browser-dynamic": "5.2.11",
"#ionic-native/barcode-scanner": "^4.20.0",
"#ionic-native/call-number": "^4.18.0",
"#ionic-native/core": "~4.18.0",
"#ionic-native/email-composer": "^4.18.0",
"#ionic-native/geolocation": "^4.20.0",
"#ionic-native/in-app-browser": "^4.18.0",
"#ionic-native/network": "^4.20.0",
"#ionic-native/splash-screen": "~4.18.0",
"#ionic-native/status-bar": "~4.18.0",
"#ionic/storage": "2.2.0",
"call-number": "1.0.1",
"cordova-android": "7.1.4",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-email-composer": "0.9.2",
"cordova-plugin-geolocation": "4.0.1",
"cordova-plugin-inappbrowser": "3.0.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^3.1.2",
"cordova-plugin-network-information": "2.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"ionic-angular": "3.9.3",
"ionicons": "3.0.0",
"leaflet": "^1.5.1",
"phonegap-plugin-barcodescanner": "8.0.1",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.29"
},
"devDependencies": {
"#ionic/app-scripts": "3.2.1",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-network-information": {},
"phonegap-plugin-barcodescanner": {},
"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": {},
"mx.ferreyra.callnumber": {},
"cordova-plugin-email-composer": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-geolocation": {}
},
"platforms": [
"android"
]
}
}

What version of cordova-ios are you using? I had the same error, after trying different things for a couple of days I deleted the plugins folder, then compiled for cordova-ios#4.5.5 and it worked.
ionic cordova platform add ios#4.5.5

Related

Ionic 5 App not Refreshing HomeScreen after Login

I have an Ionic App that was created with Ionic 3 and recently updated to Ionic 5 (Angular 8).
The App is running in Chrome Browser (with ionic serve) without any problems, and everything is working the way it should.
For almost 2 weeks I am trying to make a version running for iOS.
I have the latest XCode 12 installed and tried to create a build with ionic cordova build ios --prod. After the build is finished I open the Project-File in xCode and try to test it on my iPhone.
The Login-Screen appears and the user can authenticate by clicking a login button. This opens a InAppBrowser where the user can be authenticated. After a successful authentication the InAppBrowser closes and a logged-in flag is set to true.
Usually, this should allow to show some tiles content within the home screen.
For some reason the page is not refreshed and it does not show the tiles.
The first Rest-request seems to be working fine and I can see after I was debugging the home-page that the user-information is received successfully.
In xCode I can see some error messages:
2021-03-11 10:37:06.003856+0100 EPDM[795:40716] WF: _WebFilterIsActive returning: NO
2021-03-11 10:37:06.370470+0100 EPDM[795:40716] [ProcessSwapping] 0x108c981a8 - ProvisionalPageProxy::didFailProvisionalLoadForFrame: pageProxyID=13 webPageID=23, frameID=3, navigationID=3
2021-03-11 10:37:06.370687+0100 EPDM[795:40716] [Process] 0x102079218 - [pageProxyID=13, webPageID=18, PID=804] WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain = NSURLErrorDomain, code = -1004
2021-03-11 10:37:06.371059+0100 EPDM[795:40716] webView:didFailProvisionalNavigation - -1004: Could not connect to the server.
2021-03-11 10:37:15.669294+0100 EPDM[795:40716] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
My question is what might be causing this error?
Thank you in advance for your answers.
"config": {
"ionic_webpack": "./config/webpack.config.js"
},
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"fix": "tslint --c tslint.json 'src/**/*.ts"
},
"dependencies": {
"#angular/animations": "8.2.14",
"#angular/common": "8.2.14",
"#angular/compiler": "8.2.14",
"#angular/compiler-cli": "8.2.14",
"#angular/core": "8.2.14",
"#angular/flex-layout": "^8.0.0-beta.27",
"#angular/forms": "8.2.14",
"#angular/http": "7.2.16",
"#angular/platform-browser": "8.2.14",
"#angular/platform-browser-dynamic": "8.2.14",
"#angular/router": "8.2.14",
"#ionic-native-mocks/http": "^2.0.12",
"#ionic-native/abbyy-rtr": "^5.31.1",
"#ionic-native/barcode-scanner": "^5.31.1",
"#ionic-native/camera": "^5.31.1",
"#ionic-native/core": "^5.31.1",
"#ionic-native/http": "^5.31.1",
"#ionic-native/in-app-browser": "^5.31.1",
"#ionic-native/ionic-webview": "^5.31.1",
"#ionic-native/splash-screen": "^5.31.1",
"#ionic-native/status-bar": "^5.31.1",
"#ionic/angular": "^5.5.4",
"#ionic/angular-toolkit": "2.3.3",
"#ionic/storage": "2.2.0",
"#ngx-translate/core": "^9.1.1",
"#ngx-translate/http-loader": "^2.0.1",
"cordova-android": "^6.4.0",
"cordova-browser": "^4.1.0",
"cordova-ios": "6.2.0",
"cordova-plugin-3dtouch": "1.3.5",
"cordova-plugin-abbyy-rtr-sdk": "^1.0.4",
"hammerjs": "^2.0.8",
"ionicons": "5.4.0",
"lodash": "^4.17.20",
"ngx-progressbar": "^2.1.1",
"npm": "^6.14.8",
"phonegap-plugin-barcodescanner": "^8.1.0",
"rxjs": "^6.6.3",
"rxjs-compat": "^6.6.3",
"svg-pan-zoom": "^3.6.0",
"sw-toolbox": "3.6.0",
"tslint-fix": "^0.1.3",
"zone.js": "0.11.4"
},
"devDependencies": {
"#ahovakimyan/cordova-plugin-wkwebviewxhrfix": "git+https://github.com/AraHovakimyan/cordova-plugin-wkwebviewxhrfix.git",
"#angular-devkit/build-angular": "0.803.19",
"#angular-devkit/build-webpack": "0.803.19",
"#angular-devkit/core": "8.2.2",
"#angular-devkit/schematics": "8.2.2",
"#angular/cli": "8.3.29",
"#angular/compiler-cli": "8.2.14",
"#babel/compat-data": "7.8.0",
"#babel/preset-env": "7.8.0",
"#types/node": "^8.0.45",
"angular2-template-loader": "^0.6.2",
"babel-loader": "8.1.0",
"cordova-plugin-advanced-http": "^3.1.0",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-cookies": "0.0.2",
"cordova-plugin-deeplinks": "^1.1.1",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-inappbrowser": "^5.0.0",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-keychain-touch-id": "^3.2.1",
"cordova-plugin-splashscreen": "^6.0.0",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-wkwebviewxhrfix": "^0.1.0",
"cordova-sqlite-storage": "^5.1.0",
"html-loader": "^0.5.1",
"ionic-plugin-keyboard": "^2.2.1",
"istanbul-instrumenter-loader": "^3.0.0",
"null-loader": "^0.1.1",
"phonegap-plugin-barcodescanner": "^8.1.0",
"ts-loader": "^3.0.3",
"ts-node": "^3.0.2",
"typescript": "3.5.1",
"ws": "3.3.2"
},
"description": "An EpdmMobileApps project",
"cordova": {
"plugins": {
"cordova-sqlite-storage": {},
"cordova-plugin-keychain-touch-id": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-deeplinks": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-cookies": {},
"cordova-plugin-advanced-http": {
"OKHTTP_VERSION": "3.10.0"
},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-wkwebviewxhrfix": {}
},
"platforms": [
"ios",
"android"
]
}
}
I did try to pin-point the code that was causing this problem.
I was commenting out some steps during the login that might cause problems.
After commenting out the call of the InAppBrowser, i did not see any more errors.
I realized, that the redirect that i received from the backend caused an loaderror -event within the InAppBrowser. This is what created the
'''
webView:didFailProvisionalNavigation - -1004: Could not connect to the server.
'''
error message.
My other code was called from within this InAppBrowser loaderror Event, and i guess that the WebView is not able to handle this after an error occurred.

Error: cannot find module "." when deploying to ios - Ionic 3

Error Description:
I built the project on VsCode using "ionic cordova build ios --prod", opened it in XCode (project.xcworkspace) and deployed it to an iPhone. However, when I open the app it gets stuck on a blank page. I debugged it using safari's development tool and I got the following error on console: "Error: cannot find module "." ".
What I've tried:
I researched the error and tried a couple solution, but no luck.
Changed typescript version to "~2.6.2", "2.6.2", "2.8.3"
Removed "^" from typescript version;
Changed app-script version to "3.1.9", "3.2.1", "3.2.2", "3.2.3"
Went through my imports to see if any of them had "/udm", but none of them do;
Also tried different XCode versions: 8, 9, 10 and 12;
Tried adding different versions of ios platform: 4.5.0, 4.5.5, 5.0.1, 5.1.0 and the latest;
Here are some links I visited, had no luck with their solutions though:
https://forum.ionicframework.com/t/build-in-prod-mode-cannot-find-module/132231/7
Ionic 3: Build in “prod” mode: Cannot find module “.”
https://forum.ionicframework.com/t/runtime-error-cannot-find-module/93967/3
How can I resolve Ionic Uncaught Error: Cannot find module "." when adding new page?
Info:
ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 10.0.0
local packages:
#ionic/app-scripts : 3.2.4
Cordova Platforms : ios 5.1.0
Ionic Framework : ionic-angular 3.9.2
System:
ios-deploy : 1.11.3
Node : v14.15.0
npm : 6.14.8
OS : macOS High Sierra
Xcode : Xcode 9.2 Build version 9C40b
Package.json:
{
"name": "name",
"version": "0.0.1",
"author": "author",
"homepage": "https://homepage.com",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/animations": "5.2.11",
"#angular/common": "5.2.11",
"#angular/compiler": "5.2.11",
"#angular/compiler-cli": "5.2.11",
"#angular/core": "5.2.11",
"#angular/forms": "5.2.11",
"#angular/http": "^7.2.10",
"#angular/platform-browser": "5.2.11",
"#angular/platform-browser-dynamic": "5.2.11",
"#grpc/grpc-js": "^1.1.7",
"#ionic-native/app-availability": "^4.20.0",
"#ionic-native/app-version": "^4.15.0",
"#ionic-native/barcode-scanner": "^4.9.0",
"#ionic-native/camera": "^4.7.0",
"#ionic-native/core": "4.7.0",
"#ionic-native/file": "^4.20.0",
"#ionic-native/file-path": "^4.7.0",
"#ionic-native/fingerprint-aio": "^4.20.0",
"#ionic-native/firebase": "^4.20.0",
"#ionic-native/firebase-crashlytics": "^5.30.0",
"#ionic-native/header-color": "^4.17.0",
"#ionic-native/http": "^4.20.0",
"#ionic-native/in-app-browser": "^3.1.0",
"#ionic-native/ionic-webview": "^5.0.0",
"#ionic-native/pin-dialog": "^4.20.0",
"#ionic-native/push": "^3.14.0",
"#ionic-native/social-sharing": "^4.15.0",
"#ionic-native/splash-screen": "4.7.0",
"#ionic-native/status-bar": "^4.7.0",
"#ionic-native/vibration": "^4.8.0",
"#ionic/storage": "2.1.3",
"angularfire2": "^5.4.2",
"brmasker-ionic-3": "^1.5.3",
"cordova-ios": "4.5.5",
"cordova-plugin-appavailability": "^0.4.2",
"cordova-plugin-headercolor": "^1.0.0",
"cordova-plugin-inappbrowser": "^3.1.0",
"cordova-plugin-ionic-webview": "^4.1.3",
"cordova-plugin-pin-dialog": "^0.1.3",
"cordova-plugin-splashscreen": "6.0.0",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-vibration": "^3.1.1",
"cordova-plugin-whitelist": "1.3.4",
"crypto-js": "^3.1.9-1",
"firebase": "^7.2.4",
"ionic-angular": "3.9.2",
"ionic-stepper": "^1.1.0",
"ionicons": "3.0.0",
"ngx-barcode": "^0.2.4",
"ngx-qrcode2": "0.0.9",
"onesignal-cordova-plugin": "^2.11.1",
"rxjs": "^6.4.0",
"rxjs-compat": "^6.4.0",
"semver": "^7.3.2",
"sw-toolbox": "^3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"#ionic/app-scripts": "3.2.4",
"#types/node": "7.0.7",
"cordova-android": "^8.0.0",
"cordova-plugin-advanced-http": "^3.1.0",
"cordova-plugin-androidx": "^3.0.0",
"cordova-plugin-androidx-adapter": "^1.1.1",
"cordova-plugin-app-version": "^0.1.12",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-filepath": "^1.5.6",
"cordova-plugin-fingerprint-aio": "git+https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio.git#f8e5588011506b4a386cbfa16346cd6b5ab85349",
"cordova-plugin-firebase-lib": "^5.1.1",
"cordova-plugin-ionic-keyboard": "2.0.5",
"cordova-plugin-x-socialsharing": "^5.4.1",
"es6-promise-plugin": "^4.2.2",
"phonegap-plugin-barcodescanner": "^8.0.0",
"typescript": "3.2.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-vibration": {},
"cordova-plugin-headercolor": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-pin-dialog": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-appavailability": {},
"onesignal-cordova-plugin": {},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-filepath": {},
"cordova-plugin-file": {},
"cordova-plugin-advanced-http": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-fingerprint-aio": {
"FACEID_USAGE_DESCRIPTION": "Confirme sua digital"
},
"cordova-plugin-firebase-lib": {},
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-app-version": {},
"cordova-plugin-ionic-keyboard": {},
"phonegap-plugin-barcodescanner": {},
"cordova-plugin-x-socialsharing": {
"PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION": "This app requires photo library access to function properly.",
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "This app requires photo library access to function properly."
},
"cordova-plugin-splashscreen": {}
},
"platforms": [
"ios"
]
}
}

Ionic Cordova phonegap-plugin-push did work on IOS but stopped recently with 'kill() returned unexpected error 1'

I have added phonegap-plugin-push plugin to an ionic 4.10.2 about two months ago,
it worked and I left the project alone for a while,
now when I recompile it (I don't have the working version anymore) it doesn't work.
The only notable difference since then is the console messages:
kill() returned unexpected error 1
as I have read they have to do with WKWebview and it was never been fixed,
but no one have ever mentioned it has anything to do with push notifications
I also get PushPlugin skip badge
I don't see any version changes in package.json that could indicate a change in versions of plugins.
{
"name": "*******",
"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/animations": "^8.2.13",
"#angular/cdk": "^8.2.3",
"#angular/common": "~8.1.2",
"#angular/core": "~8.1.2",
"#angular/forms": "~8.1.2",
"#angular/material": "^8.2.3",
"#angular/platform-browser": "~8.1.2",
"#angular/platform-browser-dynamic": "~8.1.2",
"#angular/router": "~8.1.2",
"#ionic-native/call-number": "^5.18.0",
"#ionic-native/camera": "^5.17.0",
"#ionic-native/core": "^5.0.0",
"#ionic-native/launch-navigator": "^5.17.0",
"#ionic-native/push": "^5.19.1",
"#ionic-native/splash-screen": "^5.0.0",
"#ionic-native/status-bar": "^5.0.0",
"#ionic/angular": "^4.7.1",
"#ionic/storage": "^2.2.0",
"angular2-moment": "^1.9.0",
"angular2-signaturepad": "^2.9.0",
"call-number": "^1.0.1",
"cordova-android": "8.1.0",
"cordova-ios": "4.5.5",
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^4.0.0",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-statusbar": "2.4.2",
"cordova-plugin-whitelist": "1.3.3",
"cordova-sqlite-storage": "^3.4.0",
"cordova-support-google-services": "^1.3.2",
"core-js": "^2.5.4",
"es6-promise-plugin": "^4.2.2",
"hammerjs": "^2.0.8",
"mx.ferreyra.callnumber": "0.0.2",
"phonegap-plugin-multidex": "^1.0.0",
"phonegap-plugin-push": "2.3.0",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"uk.co.workingedge.phonegap.plugin.launchnavigator": "^5.0.4",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/architect": "~0.801.2",
"#angular-devkit/build-angular": "~0.801.2",
"#angular-devkit/core": "~8.1.2",
"#angular-devkit/schematics": "~8.1.2",
"#angular/cli": "~8.1.2",
"#angular/compiler": "~8.1.2",
"#angular/compiler-cli": "~8.1.2",
"#angular/language-service": "~8.1.2",
"#ionic/angular-toolkit": "~2.0.0",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.3",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-sqlite-storage": {},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"uk.co.workingedge.phonegap.plugin.launchnavigator": {
"GOOGLE_API_KEY_FOR_ANDROID": "1234",
"OKHTTP_VERSION": "3.+"
},
"mx.ferreyra.callnumber": {},
"call-number": {},
"phonegap-plugin-push": {}
},
"platforms": [
"android",
"ios"
]
}
}
nothing have change with Firebase and Provisioning files either.
any ideas? did it happen to anyone else recently? or is it just a coincidence and I should put more effort in searching the problem elsewhere

ionic 3 issue : *** Terminating app due to uncaught exception

guys I am working on an ionic project and we are stucked for very very long time on this issue:
[1230:250895] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
libc++abi.dylib: terminating with uncaught exception of type NSException
We have no idea where the error comes from, by using breakpoints this is the error part:
int main(int argc, char* argv[])
{
#autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, #"AppDelegate");
return retVal;
}
}
I believe its a package issue but here are my package.json
{
"name": "discover_v2",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint"
},
"dependencies": {
"#angular/animations": "5.2.11",
"#angular/common": "5.2.11",
"#angular/compiler": "5.2.11",
"#angular/compiler-cli": "5.2.11",
"#angular/core": "5.2.11",
"#angular/forms": "5.2.11",
"#angular/http": "5.2.11",
"#angular/platform-browser": "5.2.11",
"#angular/platform-browser-dynamic": "5.2.11",
"#ionic-native/barcode-scanner": "^4.16.0",
"#ionic-native/camera": "^4.17.0",
"#ionic-native/core": "~4.15.0",
"#ionic-native/device": "^5.2.0",
"#ionic-native/facebook": "^4.17.0",
"#ionic-native/fcm": "^4.18.0",
"#ionic-native/file-transfer": "^4.17.0",
"#ionic-native/firebase": "^4.18.0",
"#ionic-native/http": "^4.17.0",
"#ionic-native/in-app-browser": "^4.17.0",
"#ionic-native/local-notifications": "^4.18.0",
"#ionic-native/splash-screen": "~4.15.0",
"#ionic-native/status-bar": "~4.15.0",
"#ionic/pro": "2.0.3",
"#ionic/storage": "2.2.0",
"cordova-android": "7.1.4",
"cordova-browser": "5.0.4",
"cordova-ios": "5.0.0",
"cordova-plugin-advanced-http": "^2.0.1",
"cordova-plugin-android-support-v13": "git+https://github.com/nnexai/cordova-plugin-android-support-v13.git",
"cordova-plugin-camera": "4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-facebook4": "1.7.4",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "1.7.1",
"cordova-plugin-firebase": "2.0.5",
"cordova-plugin-inappbrowser": "3.0.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.2.0",
"cordova-plugin-local-notifications": "1.0.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"ngx-qrcode2": "0.0.9",
"phonegap-plugin-barcodescanner": "^8.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"#ionic/app-scripts": "3.2.0",
"#ionic/lab": "1.0.22",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"phonegap-plugin-barcodescanner": {
"CAMERA_USAGE_DESCRIPTION": "Scan QR-Codes",
"PHOTOLIBRARY_USAGE_DESCRIPTION": "App would like to access the library.",
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "App would like to access the library."
},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-advanced-http": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-firebase": {},
"cordova-plugin-camera": {
"CAMERA_USAGE_DESCRIPTION": "Scan QR-Codes",
"PHOTOLIBRARY_USAGE_DESCRIPTION": "App would like to access the library.",
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "App would like to access the library."
},
"cordova-plugin-facebook4": {
"APP_ID": "338050196981589",
"APP_NAME": "usediscover"
},
"cordova-plugin-statusbar": {},
"cordova-plugin-inappbrowser": {}
},
"platforms": [
"browser",
"android",
"ios"
]
}
}
Possible duplicate of NSArrayM insertObject:atIndex:]: object cannot be nil'

Ionic 3 + One Signal handleNotificationReceived doesn't get fired

I'm following this Ionic SDK Setup link. I'm setting up the push notification on my app.
It's working, I can get the notification. Here's my code.
this.platform.ready().then(() => {
let OneSignal = window["plugins"].OneSignal;
OneSignal
.startInit(AppSettings.ONESIGNAL_APP_ID)
.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
.handleNotificationOpened(function(jsonData) {
console.log('OPENED');
})
.handleNotificationReceived(function(jsonData) {
console.log('RECEIVED');
})
.endInit();
OneSignal.getIds(notificationsCallBack.getIdReceived.bind(this));
});
However, the function handleNotificationReceived is only called if the app is open. I need to execute some code (I need an in-app badge), even if the app is closed. I'm setting the content_available to true on my OneSignal API, I also tested directly on the OneSignal website and I couldn't make it works. The function handleNotificationOpened works as expected.
How can I handle the notification received event when my app is not open?
I'm testing on iPhone 6+, iOS 11.0.3
My env:
Ionic 3.12.0
Cordova 7.0.1
My package.json
{
"name": "XXX",
"author": "XXXX XX",
"homepage": "XXX",
"private": true,
"scripts": {
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "4.2.2",
"#angular/compiler": "4.2.2",
"#angular/compiler-cli": "4.2.2",
"#angular/core": "4.2.2",
"#angular/forms": "4.2.2",
"#angular/http": "4.2.2",
"#angular/platform-browser": "4.2.2",
"#angular/platform-browser-dynamic": "4.2.2",
"#angular/platform-server": "4.2.2",
"#angular/router": "^4.2.2",
"#ionic-native/camera": "^3.4.4",
"#ionic-native/core": "^3.10.3",
"#ionic-native/facebook": "^4.3.1",
"#ionic-native/geolocation": "^3.2.2",
"#ionic-native/google-maps": "^3.4.4",
"#ionic-native/google-plus": "^3.4.4",
"#ionic-native/image-picker": "^3.2.2",
"#ionic-native/native-storage": "^3.4.4",
"#ionic-native/splash-screen": "^3.12.1",
"#ionic-native/status-bar": "^3.12.1",
"#ionic-native/toast": "^3.10.3",
"#ionic-native/transfer": "^3.2.2",
"#ionic/storage": "^2.0.0",
"bourbon": "^4.2.7",
"cordova-ios": "^4.5.1",
"cordova-plugin-camera": "^2.4.1",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-console": "^1.0.7",
"cordova-plugin-crop": "^0.3.1",
"cordova-plugin-device": "^1.1.6",
"cordova-plugin-facebook4": "^1.7.4",
"cordova-plugin-googlemaps": "^2.0.11",
"cordova-plugin-googlemaps-sdk": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git",
"cordova-plugin-googleplus": "^5.1.1",
"cordova-plugin-nativestorage": "^2.2.2",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.3",
"cordova-plugin-whitelist": "^1.3.2",
"cordova-plugin-x-toast": "^2.6.0",
"cordova-sqlite-storage": "^2.0.4",
"cropperjs": "^1.1.0",
"font-awesome": "^4.7.0",
"ionic-angular": "3.3.0",
"ionic-native": "2.9.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionic2-auto-complete": "^1.5.0-beta",
"ionicons": "3.0.0",
"ios-sim": "^6.1.2",
"ng2-cookies": "^1.0.4",
"onesignal-cordova-plugin": "^2.0.11",
"rxjs": "5.4.0",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.7",
"typescript": "2.3.4"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard",
"cordova-plugin-geolocation",
"cordova-plugin-compat",
"cordova-plugin-file-transfer",
"cordova-plugin-file"
],
"cordovaPlatforms": [
{
"platform": "ios",
"version": "",
"locator": "ios"
},
{
"platform": "android",
"version": "",
"locator": "android"
}
],
"description": "ion2-FullApp: The Best Ionic 2 Starter app",
"config": {
"ionic_sass": "./config/sass.config.js",
"ionic_copy": "./config/copy.config.js"
},
"cordova": {
"platforms": [
"ios"
],
"plugins": {
"cordova-plugin-camera": {
"CAMERA_USAGE_DESCRIPTION": " ",
"PHOTOLIBRARY_USAGE_DESCRIPTION": " "
},
"cordova-plugin-console": {},
"cordova-plugin-crop": {},
"cordova-plugin-device": {},
"cordova-plugin-facebook4": {
"APP_ID": "XX",
"APP_NAME": "XXX"
},
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "XX"
},
"cordova-plugin-nativestorage": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-x-toast": {},
"cordova-sqlite-storage": {},
"ionic-plugin-keyboard": {},
"onesignal-cordova-plugin": {},
"cordova-plugin-googlemaps": {
"API_KEY_FOR_ANDROID": "XX",
"API_KEY_FOR_IOS": "XX",
"LOCATION_WHEN_IN_USE_DESCRIPTION": "Show your location on the map",
"LOCATION_ALWAYS_USAGE_DESCRIPTION": "Trace your location on the map",
"key": "XX"
}
}
}
}
The notification opened event was fixed in the OneSignal Cordova SDK 2.2.0. It was only an issue for iOS 11 devices.
you need to check this. Let me know if it works for you.
You need to set content_available and mutable_content in true in the body of the POST request.

Resources