Cordova plugins delayed execution on iOS

I am building an Ionic hybrid app and I have 4 plugins installed.

cordova-plugin-screen-orientation
cordova-plugin-app-version
cordova-plugin-geolocation
cordova-plugin-contacts

All of them work as expected on Android however, on iOS, whenever I trigger the plugin (usually with a button click), nothing happens, if I double click the home button(or if I minimize and open up the app again), the plugins has executed and is displaying what I see on Android.

I have tried wrapping the call to the plugin in a $timeout but that didn’t do anything different.

Any help would be appreciated as I have search all over hell on this and can’t seem to find the issue.

Here is my apple setup:

Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: MacOS Sierra
Node Version: v6.10.1
Xcode version: Xcode 8.3.2 Build version 8E002
1 Like

Oh, I remember that someone had the exact same problem some time ago. He could also trigger the execution of the plugin code but pulling down the status bar (for notification center).

Unfortunately I don’t remember his solution - so you will have to find this topic again. I participated in the discussion, so you can include my user name as well.

The culprit was the content security policy in my index.html file.
Replacing it with this:

< meta http-equiv=ā€œContent-Security-Policyā€ content=ā€œdefault-src gap://ready file://* *; script-src ā€˜self’ ā€˜unsafe-inline’ ā€˜unsafe-eval’ *; style-src ā€˜self’ ā€˜unsafe-inline’ *ā€>

Fixed the problem

1 Like