title: Xcode 7 Invalid Device State - XPC_ERROR
body: <p>When I run <code>cordova emulate ios</code> (or <code>ionic emulate ios</code>), I get an Invalid Device State Error code=159.  If I leave the simulator open, reset the contents, and re-run the command, I do not get the above error but the simulator never finishes loading the app.</p>
  
  <p>In both cases, the system logs hundreds of <code>XPC_ERROR_CONNECTION_INTERRUPTED</code> entries from <code>instruments</code> or <code>mdworker</code>.  Here's the last few entires of a recent attempt:</p>
  
  <pre><code>Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
  Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
  Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: Database mapping failed with result -10822, retrying
  Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
  Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
  Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: Database mapping failed with result -10822, retrying
  Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
  Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
  Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: Database mapping failed with result -10822, retrying
  Feb 21, 2016, 2:08:59 PM instruments[93351]: LaunchServices: received XPC_ERROR_CONNECTION_INTERRUPTED trying to map database
  Feb 21, 2016, 2:08:59 PM com.apple.xpc.launchd[1]: Caller not allowed to perform action: instruments.93351, action = service submission, code = 1: Operation not permitted, uid = 503, euid = 503, gid = 20, egid = 20, asid = 100007
  Feb 21, 2016, 2:09:30 PM com.apple.CoreSimulator.CoreSimulatorService[549]: Error Domain=com.apple.CoreSimulator.SimError Code=159 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}
  Feb 21, 2016, 2:09:30 PM com.apple.CoreSimulator.CoreSimulatorService[549]: Error Domain=com.apple.CoreSimulator.SimError Code=159 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}
  Feb 21, 2016, 2:09:30 PM com.apple.CoreSimulator.CoreSimulatorService[549]: Error looking up host support port
  Feb 21, 2016, 2:09:32 PM com.apple.CoreSimulator.CoreSimulatorService[549]: Error Domain=com.apple.CoreSimulator.SimError Code=159 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}
  Feb 21, 2016, 2:09:32 PM com.apple.CoreSimulator.CoreSimulatorService[549]: Error Domain=com.apple.CoreSimulator.SimError Code=159 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}
  Feb 21, 2016, 2:09:32 PM com.apple.CoreSimulator.CoreSimulatorService[549]: Error looking up host support port
  </code></pre>
  
  <p>I know there are a few other posts on this but none seem to address my issue.  Im running everything locally, permissions are correctly configured in the user directory.  I've reproduced this error on Xcode 7.21 as well as 7.3, with using a firewall and without, with using node via nvm and on its own.</p>
  
  <p>My current config:</p>
  
  <pre><code>Cordova CLI: 6.0.0
  Gulp version:  CLI version 3.9.1
  Gulp local:   Local version 3.9.1
  Ionic Version: 1.2.4-nightly-1917
  Ionic CLI Version: 1.7.14
  Ionic App Lib Version: 0.7.0
  ios-deploy version: 1.8.5
  ios-sim version: 5.0.6
  OS: Mac OS X El Capitan 10.11.3
  Node Version: v5.6.0
  Xcode version: Xcode 7.3 Build version 7D141l
  </code></pre>
  
  <p>Some postings suggest this has to do with Time Machine and Spotlight.  I have no clue, but if it helps - I'm currently not using Time Machine and I've placed the entire HD in TM's excluded folders.  Lastly, from researching the 'could not store' log below, I added the <code>/private/var/db/lsd</code> folder...however it hasn't corrected the problem.  This may be unrelated, but I'm not sure.</p>
  
  <pre><code>Feb 21, 2016, 3:06:28 PM com.apple.xpc.launchd[1]: Service only ran for 1 seconds. Pushing respawn out by 9 seconds.
  Feb 21, 2016, 3:06:29 PM com.apple.usbmuxd[94227]: stopping.
  Feb 21, 2016, 3:06:30 PM com.apple.usbmuxd[16479]: log filter changed from 4 to 6
  Feb 21, 2016, 3:06:30 PM com.apple.usbmuxd[16479]: usbmuxd-364 on Aug  4 2015 at 14:36:18, running 64 bit
  Feb 21, 2016, 3:07:37 PM lsd[295]: LaunchServices: Could not store lsd-identifiers file at /private/var/db/lsd/com.apple.lsdschemes.plist
  Feb 21, 2016, 3:07:37 PM lsd[295]: LaunchServices: Could not store lsd-identifiers file at /private/var/db/lsd/com.apple.lsdschemes.plist
  Feb 21, 2016, 3:08:27 PM syslogd[51]: ASL Sender Statistics
  </code></pre>
  
  <p>Thanks for your help</p>