iPhone froze after installing ionic app through xcode

Just rendered my iPhone completely stuck, requiring manually reboot (home & power press and hold)

Steps to recreate:

  1. Built an ionic app prototype.
  2. Deployed app to Android Play Store in
    alpha release program.
  3. Installed on a dozen devices, no problems.
  4. Tested app in iOS Simulator, everything looked good.
  5. Finally got App Developer License approved.
  6. Loaded .xcodeproj file in Xcode 6.1.1
  7. Plugged in iPhone6+, selected it from Device list
  8. Hit Run button (following these instructions:
  9. App installed & everything was great.
  10. Pressed home button
  11. Pressed app icon to relaunch app.
  12. Nothing happened, (actually app icon became shaded)
  13. No other apps open, couldnt open recent apps.
  14. Could not turn off phone
  15. A minute later the screen turned off, then Siri started. A minute later Siri said she couldnt hear me.
  16. Finally pressed and held Power + Home until it rebooted…

This issue wasn’t one of the common issues mentioned in the cordova page linked above.

XCode console output:

2015-02-03 21:45:49.112 myApp[3202:1294003] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/5D5756FF-B7A1-43C1-B820-7BD8BF506CA7/Library/Cookies/Cookies.binarycookies
2015-02-03 21:45:49.279 myApp[3202:1294003] Apache Cordova native platform version 3.7.0 is starting.
2015-02-03 21:45:49.280 myApp[3202:1294003] Multi-tasking -> Device: YES, App: YES
2015-02-03 21:45:49.293 myApp[3202:1294003] Unlimited access to network resources
2015-02-03 21:45:49.403 myApp[3202:1294003] [CDVTimer][keyboard] 0.157952ms
2015-02-03 21:45:49.403 myApp[3202:1294003] [CDVTimer][TotalPluginStartup] 0.472009ms
2015-02-03 21:45:50.006 myApp[3202:1294003] Resetting plugins due to page load.
2015-02-03 21:45:50.760 myApp[3202:1294003] Finished load of: file:///private/var/mobile/Containers/Bundle/Application/08D32EA7-C001-4D53-B729-F63081D4E97A/myApp.app/www/index.html#/login
2015-02-03 21:45:55.711 myApp[3202:1294003] current state is: tab.home
2015-02-03 21:45:59.178 myApp[3202:1294003] current state is: tab.calendar
2015-02-03 21:46:03.708 myApp[3202:1294003] current state is: tab.detail
2015-02-03 21:46:15.773 myApp[3202:1294003] total 94

The only thing I can note is that despite running:

cordova plugin rm org.apache.cordova.console

when I prepped app for Android build, it’s still logging my console output.
Otherwise nothing jumps out at me.

Suggestions? Comments? Solutions?
Any and all much appreciated!

After more testing I’ve narrowed down the exact path to reproduce this error:

  1. Install app on iPhone using XCode
  2. Once app is launched, go home by pressing home button on the device
  3. Double press home button to launch recent apps/task manager
  4. Swipe the cordova/ionic app up to kill it.
  5. iPhone is now “frozen”
    I get an (lldb) in the console and this pops up in the debug console:

The good news is that this doesn’t happen if you install the app on the iPhone and then unplug the device from XCode. Then you can run and kill the app as much as you like and everything continues to function.

I tested this with the helloWorld app as well as my own app and confirmed the same behavoir on both.

Anyone know why this happens when connected to xCode?

Thanks in advance!

Hmm, just tried this out with our tabs example.

$ ionic start tmp tabs && cd tmp
$ ionic platform add ios
$ open platforms/ios/tmp.xcodeproj/

Installed on my iphone6 with out any issues.
Did you change anything or add any new plugins?
Was version of osx are you using?
What version of xcode are you using?

I find that I get ‘lockups’ if I RUN the app on my device on my iPhone from XCode when I do the following:

  • If I forget to use XCode to shut down the app and instead press the ‘Home’ button to close it, then try tapping on the icon to open the app again. Usually get the shaded icon and the entire phone locks up.

If however, I shut down the running app from within XCode, by clicking the ‘Stop Running’ button, then I can restart the app on the device with no problems.

I believe it has something to do with how the XCode debugger works. Either the PC or the device is trying to poll each other constantly and if I deviate from what they are expecting it causes problems on my iPhone.

So, my basic rule when developing is: Use XCode to install and ‘Run’ the app on the phone, and as soon as it starts up, use XCode to shut down the app, then revert to the device to start up the app and do other tests.

1 Like

@CyberFerret Thanks, this helps me prevent the issue I was having.

I’ve been using Android Studio for a couple years now and am used to pressing “run” and getting the debugger console but was not expecting:

  1. Xcode to maintain some active connection (although I can see the function in this)
  2. If that connection is broken - to mess with the phone… I would have expected Xcode to throw an error about a process being killed or something but to block the mainthread (thats my understanding at least) on my phone seems bizarre.

Most surprising is that I couldn’t find a single SO post about this… I can’t be the first newbie iOS dev to experience this.

Thanks again!

@mhartington, I tried the tabs started on my 5 and 6+ and it works fine o.O

Just to clarify: installing the app isn’t the problem. It’s force closing it while its still connected to the active Xcode debug session that would cause the device locking.

I tried my app and the helloCordova starter on both devices tonight and they’re both working fine - I’m able to force close and restart without locking the device :confused:

OSX: 10.10.2
Xcode: 6.1.1

I think I’ll just adopt @CyberFerret’s recommendation of running the app in Xcode and then making sure to Stop it before disconnecting or force quitting.

I’m just used my android logcat where I can do whatever and I can see what goes on as my app launches AND as it closes, Xcode just seems to give me warnings about how I’ll get kicked out of the app store for x, y & z…

Much appreciate the support! Loving ionic so far, it’s truly remarkable.

Ahh alright.

Yeah thats to be expected.
When you run an app via xcode, it has a few processes going on in the background (debugging tools, watching cpu/memory, etc)
It got me as well when I first started out to be honest :smile:

1 Like

I kept having this happen when the debugger and phone are still somehow linked, so a simple command line of “pkill lldb” before “ionic run ios” will ensure it doesn’t happen again.

iPhone frozen, don’t worry, you can try to use Tenorshare iPhone Care Pro to help you fix iPhone frozen . The software is a good tool to repair operating system for iPhone .

Tenorshare is not the most professional solution. Some other method may better than it. You can read this which I search on google. By the way, the method also can fix many different kind of iOS system problem.
Fix iPhone Frozen

There are usually three ways to fix a frozen iPhone:

  1. Force restart iPhone;
  2. Restore iPhone via iTunes;
  3. Apply third-party iPhone repair software.

Hey, do you fix your issue right now? If you don’t, you can try to force restart your iPhone first and then see whether it performs normally. Or you can unfreeze your iPhone through some software like Joyoshare UltFix, TunesKit, etc without data loss.