Weirdest issue i have ever met on Ionic v1.x iOS + native plugins


First of all i would like to say, that im developing mobile apps on Ionic since 2014 and this is my first post on forum, never need to make one before.

Im working on second version of app which was published in last year and there is issue i have met- only on iOS, Android works well as always:

When i open app, and im trying to run any functionality based on native plugin it is not working until click / drag status bar or drag bottom bar …right? Every plugin starts only after status bar click /drag action.

( i’ll try to make it in steps to get more “transaprency”)

mac OS Sierra 10.12.4 newest
iOS 10.3.1 ( on both - emulators and real devices ) newest
Xcode 8.3.2 newest

  • Open App
  • Click function which include Facebook Login / Camera / NatvieBrowser / CordovaClipboard or any native plugin support
  • Nothing happens
  • Do whaterever You want in app
  • Click / Drag Status Bar / Bottom Settings bar
  • Last native plugin functionality fired

Issue occur on both - mac’s device emulators and real devices

To be sure its not my app problem i had run first version ( developed in 2016, currently
on AppStore) on this MAC’s setup and everything looks same, plugins dont work until out of app UI action.

There is even a video i made to explain it better :

Thanks for any help,

Are you seeing any error statements in the log/terminal inside XCode? I’d make sure all your plugins are loading. Also, have you tried connecting an actual device and using Safari remote debugging?

I’d start with a few of these to make sure everything is working/loading as expecting.

On mac OS im debugging my app with xcode output logs.

After App start :

Error from friebase "2017-04-21 12:22:07.597615+0200 Zrabatowani[603:81319] Unable to connect to FCM. Error Code=2001 “(null)” " its not important probably ( i dont have firebase in already published app )
Some plugins start infos :
2017-04-21 12:37:02.296824+0200 Zrabatowani[627:84445] [CDVTimer][intentandnavigationfilter] 3.157020ms
2017-04-21 12:37:02.297074+0200 Zrabatowani[627:84445] [CDVTimer][gesturehandler] 0.189006ms
2017-04-21 12:37:02.297237+0200 Zrabatowani[627:84445] Starting Facebook Connect plugin
2017-04-21 12:37:02.297295+0200 Zrabatowani[627:84445] [CDVTimer][facebookconnectplugin] 0.164986ms
2017-04-21 12:37:02.320647+0200 Zrabatowani[627:84445] [CDVTimer][file] 23.166001ms
2017-04-21 12:37:02.320924+0200 Zrabatowani[627:84445] Starting Firebase plugin
2017-04-21 12:37:02.320966+0200 Zrabatowani[627:84445] [CDVTimer][firebaseplugin] 0.195980ms
and more
2017-04-21 12:37:03.214015+0200 Zrabatowani[627:84445] Resetting plugins due to page load.

After Call function which use FB plugin:
Nothing new

After Status bar drag:
FB safari page open
Zrabatowani[627:84445] THREAD WARNING: [‘FacebookConnectPlugin’] took ‘32.857910’ ms. Plugin should use a background thread.

Close facebook page :
Nothing new

Every other plugin use looks same - THREAD WARNING

Sometimes in random ( for me ) moments output shows
Zrabatowani[654:90862] INFO: fetch-response is unable to open the file /private/var/mobile/Containers/Data/Application/A3B6A3D3-E9C2-4E5A-8DDA-67A167EBEBE2/Library/Caches/ Errno: 2

Wow, that’s a super strange problem. I’m intrigued :wink:

So nothing in the log from the plugin until you drag the status bar, then when you get back to the app you always get this “THREAD WARNING: [’…’] took ‘’ ms. Plugin should use a background thread.”. Correct?

Why are you getting this error then? Did you add Firebase to the project?
If so, did you try with an unmodified project yet?

How do you “recover” the project (git? still on disk from development last year?)?

Also, just so we know what we are dealing with:

  • Please post the ouput of ionic info
  • Please post the content of your package.json
  • Please post the output of ionic platform ls and ionic plugin ls


try by downgrading ios to 4.2.1. I found issues in 4.3.1
ionic platform add ios@4.2.1

Yes, i dont even need to get back to the app, plugin is fired and logged when app is behind bar

I have Firebase in both projects ( this old and new one ) i have tried without Firebase cordova plugin ( uninstall, remove from config ect.) nothing changed.

I’ll post outputs inext post, thanks for interest of my issue

1 Like

Holded on disk from last year, git repo is repleaced by new version.

Cordova CLI: 6.5.0 
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: 1.9.1 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v4.4.4
Xcode version: Xcode 8.3.2 Build version 8E2002

There is no “Ionic Framework Version” unlike on android, even after reinstall, what may that means ?

  "name": "zrabatowani-mobile-app",
  "version": "1.1.1",
  "description": "zrabatowani-mobile-app:",
  "dependencies": {
    "gulp": "^3.5.6",
    "gulp-sass": "^2.0.4",
    "gulp-concat": "^2.2.0",
    "gulp-minify-css": "^0.3.0",
    "gulp-rename": "^1.2.0"
  "devDependencies": {
    "bower": "^1.3.3",
    "gulp-util": "^2.2.14",
    "jasmine-core": "^2.4.1",
    "karma": "^0.13.21",
    "karma-jasmine": "^0.3.7",
    "karma-phantomjs-launcher": "^1.0.0",
    "phantomjs-prebuilt": "^2.1.5",
    "shelljs": "^0.3.0"
  "cordovaPlugins": [
      "variables": {
        "APP_ID": "(xxx)",
        "APP_NAME": "(xxx)"
      "locator": "cordova-plugin-facebook4",
      "id": "cordova-plugin-facebook4"
  "cordovaPlatforms": [
Installed platforms:
  android 5.2.2
  ios 4.3.1
Available platforms: 
  amazon-fireos ~3.6.3 (deprecated)
  blackberry10 ~3.8.0
  browser ~4.1.0
  firefoxos ~3.6.3
  osx ~4.0.1
  webos ~3.7.0
com.verso.cordova.clipboard 0.1.0 "Clipboard"
cordova-plugin-camera 2.4.0 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.6 "Console"
cordova-plugin-device 1.1.5 "Device"
cordova-plugin-facebook4 1.7.4 "Facebook Connect"
cordova-plugin-file 4.3.2 "File"
cordova-plugin-file-transfer 1.6.2 "File Transfer"
cordova-plugin-firebase 0.1.20 "Google Firebase Plugin"
cordova-plugin-inappbrowser 1.7.0 "InAppBrowser"
cordova-plugin-network-information 1.3.2 "Network Information"
cordova-plugin-splashscreen 4.0.2 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

Thanks, hope it is readable

1 Like

I have tried on few versions from 4.0.X to 4.3.X ( including 4.2.1 ) no change

Ok interesting, so as soon as the app looses focus, the code execution continues.[quote=“l_cieslik, post:6, topic:87322”]
I have Firebase in both projects ( this old and new one ) i have tried without Firebase cordova plugin ( uninstall, remove from config ect.) nothing changed.

Did you also have the error you mentioned before (“Unable to connect to FCM. Error Code=2001”) in the old version? Errors always make me suspicious they cause strange things…

(Although according to this is not really a problem)[quote=“l_cieslik, post:7, topic:87322”]
Holded on disk from last year, git repo is repleaced by new version.
Ok, this means you are not having any new dependencies added. Your node_modules is also still in place and unchanged?[quote=“l_cieslik, post:7, topic:87322”]
Thanks, hope it is readable

It was ok, I formatted the blocks as “code” (using the </> button in the post toolbar above the input) to make it even more readble.

Nothing obvious jumps out at me from the environment information you posted.

Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Safari dev tools: Remote Debug your Ionic App · You can create a performance session and see what is “active” in the time between the clicks and the later execution of everything when you drag the status bar.

Ok, i have used safari inspector and something unexpected happened.
In console is error:

Refused to load gap://ready because it appears in neither the child-src directive nor the default-src directive of the Content Security Policy.

which is “incrementing to infinity”, i mean is called every tick again and again, stops only when i drag status bar and other window appear

So it makes sense that you code is not able to run. Now, why does this happen? …

Ok, here are some links that mention similar problems:

The second one describes a fix. Maybe try that?

1 Like

I have followed this error on google and found same link which you paste :

when i replaced

<meta http-equiv="Content-Security-Policy" content="default-src gap://ready file://* *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *">

in index.html everything starts work as expected,
Thanks for help, it looks like safari device debug resolved my problem and your attention as well. :slight_smile:

1 Like