App tried to load index.html before cordova webserver has started


#1

Hi, sorry if this is wrong place to ask for help. I’ve searched quite a lot about the problem I’m having but haven’t turned up anything. I’ve just taken over maintaining a mobile app built with ionic after the previous person has left our organisation. For our iOS build we are using the Telerik WKWebView http://plugins.telerik.com/cordova/plugin/wkwebview and accordingly need to run a local webserver to load local files. The problem I’m having is that the web server is starting after the index.html page is attempting to load and so the app never progresses beyond a ‘Not found’ error page.

If anyone can help or point me to where I can find help it would be greatly appreciated!

The build log in Xcode is showing this (I’ve prefixed lines of interest with ***)

2016-10-17 11:57:39.664893 Pond Mobile[11537:3055214] bundleid: com.networkforlearning.pondmobile, enable_level: 0, persist_level: 0, propagate_with_activity: 0
2016-10-17 11:57:39.669385 Pond Mobile[11537:3055214] subsystem: com.apple.siri, category: Intents, enable_level: 1, persist_level: 1, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-17 11:57:39.727031 Pond Mobile[11537:3055937] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-17 11:57:39.731692 Pond Mobile[11537:3055937] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-17 11:57:39.760629 Pond Mobile[11537:3055923] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-10-17 11:57:39.766 Pond Mobile[11537:3055214] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/david/Library/Developer/CoreSimulator/Devices/E9039A9E-072A-4695-BECF-602652B235F1/data/Containers/Data/Application/2077D1E3-F58D-43ED-9B91-3F33EB6AE5D1/Library/Cookies/com.networkforlearning.pondmobile.binarycookies
2016-10-17 11:57:39.772917 Pond Mobile[11537:3055214] subsystem: com.apple.libsqlite3, category: logging, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-17 11:57:39.816522 Pond Mobile[11537:3055214] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-17 11:57:39.881 Pond Mobile[11537:3055214] Apache Cordova native platform version 3.9.2 is starting.
2016-10-17 11:57:39.882 Pond Mobile[11537:3055214] Multi-tasking -> Device: YES, App: YES
2016-10-17 11:57:39.890 Pond Mobile[11537:3055214] Unlimited access to network resources
*** 2016-10-17 11:57:39.992 Pond Mobile[11537:3055214] Using a WKWebView
2016-10-17 11:57:40.014744 Pond Mobile[11537:3055214] subsystem: com.apple.SystemConfiguration, category: SCNetworkReachability, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 2, enable_private_data: 0
2016-10-17 11:57:40.033875 Pond Mobile[11537:3055214] subsystem: com.apple.UIKit, category: GestureEnvironment, enable_level: 0, persist_level: 0, default_ttl: 1, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-10-17 11:57:40.042 Pond Mobile[11537:3055214] [CDVTimer][base64togallery] 0.172019ms
2016-10-17 11:57:40.066 Pond Mobile[11537:3055214] [CDVTimer][file] 22.612035ms
2016-10-17 11:57:40.105 Pond Mobile[11537:3055214] [CDVTimer][splashscreen] 38.551986ms
2016-10-17 11:57:40.115 Pond Mobile[11537:3055214] [CDVTimer][statusbar] 10.190964ms
2016-10-17 11:57:40.122590 Pond Mobile[11537:3055214] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/david/Library/Developer/CoreSimulator/Devices/E9039A9E-072A-4695-BECF-602652B235F1/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2016-10-17 11:57:40.125757 Pond Mobile[11537:3055214] [MC] Filtering mail sheet accounts for bundle ID: com.networkforlearning.pondmobile, source account management: 1
2016-10-17 11:57:40.129197 Pond Mobile[11537:3055214] [MC] Result: NO
2016-10-17 11:57:40.129 Pond Mobile[11537:3055214] [CDVTimer][socialsharing] 12.973964ms
2016-10-17 11:57:40.130 Pond Mobile[11537:3055214] [CDVTimer][keyboard] 1.246989ms
2016-10-17 11:57:40.131 Pond Mobile[11537:3055214] [CDVTimer][TotalPluginStartup] 88.748991ms
*** 2016-10-17 11:57:40.131 Pond Mobile[11537:3055214] ERROR: Start Page at 'http://localhost:20000' was not found.
[DEBUG] Did open IPv4 listening socket 9
[DEBUG] Did open IPv6 listening socket 10
*** [INFO] GCDWebServer started on port 20000 and reachable at http://localhost:20000/
*** 2016-10-17 11:57:40.148 Pond Mobile[11537:3055214] Started http daemon: http://localhost:20000/

#2

Ok, solved this, In my config.xml I had to change <content src="http://localhost:2000" /> to <content src="http://localhost:20000/index.html" />