iOS app works on device only when it is connected to the Xcode or CLI ,as soon as it is disconnected the app is stuck on splash screen


#1

As long as the phone is connected to the pc , the apps works fine. As soon as it is disconnected and the app is re-run it is stuck on splash screen .

Also it shows blank screen with empty header in ionic view app.
Stuck on splash screen when not connected to pc


#2

Have you tried debugging it using Safari Remote Debugging?


#3

are you using $ ionic run ios -l ?

in case of live reload option, the config.xml creates the content src tag with the ipaddress of you computer so the webview will look for the index file on that ipaddress. When you remove the cable, the installed app will continue to refer to that ipaddress instead of the local.

Check this line in config.xml:

it should refer to index.html and not the ipaddress/index.html


#4

The content has reference to index.html and not ipAddress/index.html.


#5

then you have some error in your code. Try debugging using safari.


#6

But it works fine if the phone is connected to the computer.


#7

Again, try using Safari Remote Debug feature.


#8

Without looking at your code or access to your app, we cannot help you here. You need to see the safari console and debug your app.

When you stop ionic live reload, the config.xml is restored to original setting and hence, index.html is only shown. While still running the app, check config.xml for ipaddress/index.html. If it is there, it means that the app needs to be connected to the pc and run. if it is not there, it means that your code has the problem.

Either way safari debugger is your best friend.


#9

It may sound very naive , but can I debug a device using Safari debugger without physically connecting it to the machine ?


#10

Damn, my bad, I didn’t connect these two information together.

Tell me does your application requires an external resource on initialization?


#11

yes , it does . Time being it’s Ionic logo which is supposed to be changed soon.


#12

Have you included Cordova Whitelist plugin and security meta tag required for external connections?


#13

Did that just now, no luck. Xcode console is :
2015-09-03 17:40:47.497 BirlaSchool[1932:579555] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/0CF1A516-0566-446F-BD13-B43CCE2F7ACF/Library/Cookies/Cookies.binarycookies
2015-09-03 17:40:47.552 BirlaSchool[1932:579555] Apache Cordova native platform version 3.8.0 is starting.
2015-09-03 17:40:47.553 BirlaSchool[1932:579555] Multi-tasking -> Device: YES, App: YES
2015-09-03 17:40:47.564 BirlaSchool[1932:579555] Unlimited access to network resources
2015-09-03 17:40:47.665 BirlaSchool[1932:579555] [CDVTimer][keyboard] 0.178993ms
2015-09-03 17:40:47.858 BirlaSchool[1932:579555] [CDVTimer][splashscreen] 193.006992ms
2015-09-03 17:40:47.907 BirlaSchool[1932:579555] [CDVTimer][file] 48.169971ms
2015-09-03 17:40:47.907 BirlaSchool[1932:579555] [CDVTimer][TotalPluginStartup] 242.570996ms
2015-09-03 17:40:48.221 BirlaSchool[1932:579555] Resetting plugins due to page load.
2015-09-03 17:40:49.668 BirlaSchool[1932:579555] Failed to load webpage with error: Could not connect to the server.

This is part of index.html

The Applicttion has numerous http calls.

This is the Xcode log if I run the app on device ,after running an instance on simulator with command: ionic build ios && ionic emulate ios --livereload

2015-09-03 18:19:10.601 BirlaSchool[212:5194] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/89C0158A-E0FB-4975-BC48-79F630C549B6/Library/Cookies/Cookies.binarycookies
2015-09-03 18:19:10.746 BirlaSchool[212:5194] Apache Cordova native platform version 3.8.0 is starting.

2015-09-03 18:19:10.747 BirlaSchool[212:5194] Multi-tasking -> Device: YES, App: YES
2015-09-03 18:19:10.751 BirlaSchool[212:5194] Unlimited access to network resources
2015-09-03 18:19:10.833 BirlaSchool[212:5194] [CDVTimer][keyboard] 0.160992ms
2015-09-03 18:19:10.945 BirlaSchool[212:5194] [CDVTimer][splashscreen] 111.706972ms
2015-09-03 18:19:10.977 BirlaSchool[212:5194] [CDVTimer][file] 32.242000ms
2015-09-03 18:19:10.978 BirlaSchool[212:5194] [CDVTimer][TotalPluginStartup] 145.222008ms
2015-09-03 18:19:11.156 BirlaSchool[212:5194] Resetting plugins due to page load.
2015-09-03 18:19:13.609 BirlaSchool[212:5194] Finished load of: http://192.168.2.105:8100/#/