Run and emulate ios with live reload not working in iOS9

I picked up Ionic a couple of weeks ago to start developing an app. Everything was going swimmingly until this afternoon when my xcode updated and with it iOS in my simulator. Now when I try to run (in the simulator - I don’t have a real iOS device to try) or emulate on ios with live reload (“ionic run ios -l -c” or “ionic emulate ios -l -c”), the app gets stuck on the splash screen (I’ve tried this with a blank build of ionic tabs from the examples and this exhibits the same behaviour).

If I run or emulate without live reload, the app launches, however there appear to be issues relating to $http, angular google maps and navigator.geolocation - I’m unable to work out exactly what the issue is without live reload and the console.

My app still works perfectly in browser.

9 Likes

Xcode just updated. Same here. Hangs at ionic load screen.

Same here, the live reload is also displaying a white screen. Running without the live flat works

I am also facing this problem. We are about to launch our app and IOS 9 issues have cropped up.

Try to disable App Transport Security in iOS 9:

And make sure you read this: http://blog.ionic.io/preparing-for-ios-9/

1 Like

The plist file fixed the live reloading issue. Important to read the blog post.

Hrm. I’ve updated my AngularJS to 1.4.6 (which includes a fix for window.location), and then added the transport security entry to my plist, I’m still seeing this issue.

  • launch with xcode: works
  • launch with ionic emulate ios: works
  • launch with ionic emulate -l ios: fails

All 3 launch as: iPhone 6 - iPhone 6 / iOS 9.0 (13A340)

Here’s a gist of what my plist file looks like:

Any ideas how to debug this? There doesn’t seem to be anything particularly relevant to launching the simulator other than this, which googling implies is not a new error, and not related:

Sep 18 13:48:42 Sin com.apple.CoreSimulator.CoreSimulatorService[1476]: Could not register service com.apple.coreservices.lsuseractivity.simulatorsupport: Failed to lookup com.apple.coreservices.lsuseractivity.simulatorsupport: 0x44e
Sep 18 13:48:43 Sin airportd[74]: SecTaskLoadEntitlements failed error=22
Sep 18 13:48:43 --- last message repeated 1 time ---
Sep 18 13:48:43 Sin com.apple.SecurityServer[98]: Session 100370 created
Sep 18 13:48:43 Sin kernel[0]: AMFI: simctl(pid 16244) - [deny-mmap] mapped executable file has no team identifier in its signature: /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime
/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib
Sep 18 13:48:43 Sin com.apple.CoreSimulator.CoreSimulatorService[1476]: Failed to open /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib: dlopen(/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib, 1): no suitable image found.  Did find:
                /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib: mmap() error 1 at address=0x112B6E000, size=0x00002000 segment=__TEXT in Segment::map() mapping /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib
Sep 18 13:48:47 Sin kernel[0]: AMFI: simctl(pid 16271) - [deny-mmap] mapped executable file has no team identifier in its signature: /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib
Sep 18 13:48:47 Sin com.apple.CoreSimulator.CoreSimulatorService[1476]: Failed to open /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib: dlopen(/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib, 1): no suitable image found.  Did find:
                /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib: mmap() error 1 at address=0x10F126000, size=0x00002000 segment=__TEXT in Segment::map() mapping /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/host/liblaunch_sim.dylib

Worked for me. Thanks Zarko.

Kisses.

xxxx

What exactly do you mean by ‘fails’?
Also, you might want to issue the command with two more options: -c -s
for both console and local app server logs.

@zarko When I do ionic emulate -slc ios it never prints anything on the console, never requests any files, and the emulator just spins on my launch screen.

If I then run from Xcode after doing a -l so that the build is still configured to use live reload, I get this output in the logs (I’ve enabled the “VerboseLog” in CDVWebViewDelegate.m):

2015-09-21 16:16:23.866 OpenNMS[23071:338161] Apache Cordova native platform version 3.9.1 is starting.
2015-09-21 16:16:23.867 OpenNMS[23071:338161] Multi-tasking -> Device: YES, App: YES
2015-09-21 16:16:23.868 OpenNMS[23071:338161] Unlimited access to network resources
2015-09-21 16:16:23.912 OpenNMS[23071:338161] [CDVTimer][keyboard] 0.069022ms
2015-09-21 16:16:23.913 OpenNMS[23071:338161] [CDVTimer][admob] 0.760019ms
2015-09-21 16:16:23.919 OpenNMS[23071:338161] [CDVTimer][file] 5.910993ms
2015-09-21 16:16:23.999 OpenNMS[23071:338161] [CDVTimer][splashscreen] 79.474986ms
2015-09-21 16:16:24.003 OpenNMS[23071:338161] [CDVTimer][statusbar] 3.602982ms
2015-09-21 16:16:24.003 OpenNMS[23071:338161] [CDVTimer][TotalPluginStartup] 90.894997ms
2015-09-21 16:16:24.022 OpenNMS[23071:338161] -canOpenURL: failed for URL: "itms-books://" - error: "This app is not allowed to query for scheme itms-books"
2015-09-21 16:16:24.022 OpenNMS[23071:338161] -canOpenURL: failed for URL: "kindle://home" - error: "This app is not allowed to query for scheme kindle"
2015-09-21 16:16:24.048 OpenNMS[23071:338161] webView shouldLoad=1 (before) state=0 loadCount=-1 URL=http://172.20.1.118:8100/
2015-09-21 16:16:54.262 OpenNMS[23071:338161] webView shouldLoad=1 (after) isTopLevelNavigation=1 state=1 loadCount=0
2015-09-21 16:17:11.005 OpenNMS[23071:338161] webView didStartLoad (before). state=1 loadCount=0
2015-09-21 16:17:11.005 OpenNMS[23071:338161] webView didStartLoad (after). state=2 loadCount=1 fireCallback=1
2015-09-21 16:17:11.005 OpenNMS[23071:338161] Resetting plugins due to page load.
2015-09-21 16:17:17.790 OpenNMS[23071:338422] void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
2015-09-21 16:17:17.799 OpenNMS[23071:338161] webView didFailLoad (before). state=2 loadCount=1
2015-09-21 16:17:17.799 OpenNMS[23071:338161] webView didFailLoad (after). state=0 loadCount=-1, fireCallback=1
2015-09-21 16:17:17.808 OpenNMS[23071:338161] Failed to load webpage with error: The operation couldn’t be completed. No such file or directory

I can confirm that the NSAppTransportSecurity entry is correct in the .plist file (it’s being added by https://github.com/mhartington/cordova-config-utils which Mike Hartington pointed me to on Slack and seems to work swimmingly). Even with that, I never get much in the way of output. Trying to debug where it’s actually failing drops me into assembler outside of Cordova’s stuff that I can’t follow.

Hi,

had the same issue when trying to run live-reload (pure emulate ios worked) but with -l flag it didn’t.

From what I read, it is best to define ‘per domain’ exceptions.

Then I followed http://stackoverflow.com/questions/30731785/how-do-i-load-an-http-url-with-app-transport-security-enabled-in-ios-9/30732693#30732693 last entry from Aqib Mumtaz to whitelist just my local live domain.

Replace ‘localhost.com’ in the example with just ‘localhost’

I hope it helps
davor

A bit hard to say what the problem could be @RangerRick. I’d be guessing so instead I would recommend you take back a step and try with the simplest possible template app:
ionic start -a BlankApp blankapp blank
If live reload doesn’t work with it then at least you will limit the scope of your troubleshooting.

p.s. My own setup doesn’t depends of fiddling with XCode, all goes well when working on command line.

@zarko Huh, yeah. Even with a blank app it fails.

I did install Xcode 7 and then upgrade to El Capitan. I wonder if there’s something weird going on there. I’ll try removing Xcode and reinstalling and see if that helps.

(Excuse the deleted post, gotta stop logging in to my other account in another tab. :smiley:)

@zarko Yeaaaah, something weird is definitely going on. Re-installed Xcode. Made a blank app. Deleted ~/.ionic. Did an npm install -g ionic cordova bower ios-sim ios-deploy just to make sure everything was fresh.

Still won’t load.

I also tried “ionic emulate --address=localhost -slc ios” to see if it’s an address thing.

I also tried adding this to the info.plist just to be sure, and it’s still a no-go:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
  <key>NSExceptionDomains</key>
  <dict>
    <key>localhost</key>
    <dict>
      <key>NSIncludesSubdomains</key>
      <false/>
      <key>NSExceptionAllowsInsecureHTTPLoads</key>
      <false/>
      <key>NSExceptionRequiresForwardSecrecy</key>
      <true/>
      <key>NSExceptionMinimumTLSVersion</key>
      <string>TLSv1.2</string>
      <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
      <false/>
      <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
      <true/>
      <key>NSThirdPartyExceptionMinimumTLSVersion</key>
      <string>TLSv1.2</string>
      <key>NSRequiresCertificateTransparency</key>
      <false/>
    </dict>
  </dict>

I’m totally out of ideas at this point. :frowning:

More data, but not about success… :smile:

I created a new account on my mac, and copied my code into there. Did:

git clean -fdx
npm install
bower install
ionic state reset
ionic emulate -slc ios

Still have the same issue.

Well here’s an interesting nugget that I can’t believe I didn’t try before now… It works on my real device. Did ionic run -slc —device ios and it launches properly on my iPhone 6, and I get logs to the console.

It’s ​only​ the simulator that fails.

I have this problem as well. Applying the fix doesn’t work for me. Works fine just for emulate, but hangs with the -l flag

I have tried almost everything… fresh builds, fixing hostnames, enabling/disabling IPv6, re-downloading Xcode, blowing away and re-configuring simulators. It’s some kind of environmental bug. I spent some time going through ideas with one of the Ionic guys and we’re both stumped. At this point I’m going to just keep using a real device for development and hope that someone upstream finally figures out what’s going on… :frowning:

Same here, also tried EVERYTHING, updated ios-sim and ios-deploy as well, tried different cordova-ios versions also, also using angular 1.4.6 but also with the io9patch since I still noticed issues with the routing eventhough it should have been fixed in 1.4.6 (which is probably not the case).
But with the -l flag I can still get the instance running, but the livereloading does not work at all…
It is really slowing my dev-cycle down like crazy whished I didnt updated everything to ios9 and xcode7.

One thing i did not see yet here is the cordova whitelist plugin, it doesn’t load since the cordova-ios version is nog yet ‘4’.
So you need to add

<plugin name="cordova-plugin-whitelist" spec="1.0.0"/>

to your config.xml and re-add the ios platform, or use ionic state reset
this will probably let you use the -l flag again, but the livereloading itself won’t work :frowning:

EDIT: It’s working now - I also REMOVED this from my Index.html

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

So with the WORKING whitelist plugin, <key>NSAllowsArbitraryLoads</key><true/> in my Info.plist and the index.html security rule removed Livereloading is working again in the Simulator.

One little problem is still there; running the emulator with ionic emulate always results in a black screen - but after doing a content reset and not closing the emulator after the first run, it continues to work, but I do need to reset the content each first run.

1 Like

I have the same issue after updating el capitan & ios 9, Actually if you see the console log on the safari(no port number displayed in the safari developer menu so i need to choose the blank port) it reads ‘nativeEvalAndFetch : ReferenceError: Can’t find variable: cordova’. But the issue disappears when i connect to the VPN network. After i connected to the VPN network it asks me to choose the port then i choose the VPN port(which reads pppo). Good luck.