简体   繁体   中英

iOS cordova (phonegap) app, JavaScript code completely blocked, freezed

I have an Cordova app which runs very well on Android . Now I wanted to make an iOS version of the app too , after all this is why we used Cordova. I'll skip the settings needed to sign the code, and so on.

The big problem is that the same app does not run on iOS . JavaScript is crashed from the start of the app.

Basically the app runs only in simulator (xcode 8.3 and iPhone 4 simulator), on the device JavaScript is completely freezed. Even on the simulator for an iPhone greater or equal that iPhone 5 nothing runs anymore.

I suspect some sort of a problem with permissions for running the code or maybe a problem with one of the plugins.

The CSP line in index.html is this:

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; frame-src *; worker-src *; ">

The complete list of the plugins is below. I know that for sqllite plugin there is a small change in the code described here, tried it, does not work.

Stackoverflow - sqlite plugin on ios

Please change your code line to var db = window.openDatabase("test.db", "1.0", "test", 20000); (this is for ios) instead of var db = window.sqlitePlugin.openDatabase("test.db", "1.0", "test", 20000); (this is for android)

Plugins used in the app.

cordova-plugin-app-event 1.2.1 "Application Events"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-crosswalk-webview 2.3.0 "Crosswalk WebView Engine"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-inappbrowser 1.7.2 "InAppBrowser"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-mauron85-background-geolocation 2.2.5 "CDVBackgroundGeoloc
cordova-plugin-network-information 1.2.1 "Network Information"
cordova-plugin-spinner 1.1.0 "Spinner Plugin"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-statusbar 2.3.1-dev "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 1.4.9 "Cordova sqlite storage plugin"
cordova.plugins.diagnostic.api-22 2.3.10-api-22 "Diagnostic"
de.appplant.cordova.plugin.local-notification 0.8.5 "LocalNotification"

My problem is that I am do not know how to debug the app on iOS. And still, maybe there is just a small problem with the permissions or CSP or just a plugin that needs to be updated. Any ideea is welcomed!

To Debug an app on ios you have to use a safari browsers. And enable web inspector on device by going Settings->Safari->Advanced->Web Inspector Enabled.

Then in Safari on your Mac you should be able to pick your device from develop menu. If you cannot see the develop menu try to go to safari->prefrences->advanced->tick 'show develop in menu'

Hope with the debugger you'd be able to find your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM