Ionic-framework: bug: BUG can't open ios simulator with xcode 7

Created on 23 Nov 2015  Â·  38Comments  Â·  Source: ionic-team/ionic-framework

Type: bug

Platform: ios 8 webview

I install cordova and ionic to develop app with ios, my xcode version is 7.1.0, but when i use command

ionic emulate ios

the Simulator opened, but do nothing.

and moment for a while, the terminal show the log, like below:

** BUILD SUCCEEDED **

No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT: no such file or directory, stat '/Users/Fernando/Library/Logs/CoreSimulator/3804D671-203A-45F2-A689-1D18D049EC91/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/Fernando/Develop/dev/Javascript/Demos/ionic_demo/platforms/ios/build/emulator/HelloCordova.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/Fernando/Develop/dev/Javascript/Demos/ionic_demo/platforms/ios/cordova/console.log,--stdout,/Users/Fernando/Develop/dev/Javascript/Demos/ionic_demo/platforms/ios/cordova/console.log,--exit
Error: /Users/Fernando/Develop/dev/Javascript/Demos/ionic_demo/platforms/ios/cordova/run: Command failed with exit code 2

I can't resolve this iuuse. I have reinstall node, and reinstall cordova and ionic. And this issue always in.

ionic info

Your system information:

Cordova CLI: 5.4.0
Gulp version:  CLI version 3.9.0
Gulp local:  
Ionic Version: 1.1.1
Ionic CLI Version: 1.7.10
Ionic App Lib Version: 0.6.5
ios-deploy version: 1.8.2 
ios-sim version: 5.0.3 
OS: Mac OS X El Capitan
Node Version: v5.1.0
Xcode version: Xcode 7.1.1 Build version 7B1005

How can I solve this issue?

reply

Most helpful comment

All 38 comments

OK, I will re submit this issue.
Thanks.

Looks like the command line tools with Xcode weren't installed. Make sure they're install by opening Xcode or running xcode-select --install from the command line.

Thanks mhartington. xcode-select have installed, and version is 2339.
I have used xcode run an app very well.

So does that fix the issue?

I have got the same issue xcode command line tools installation did not help.

@mhartington I've run into a similar issue, and no, it doesn't fix it.

Hey everyone, going to close since it's not a framework issue but feel free to keep up the discussion in case others find it helpful.

Any1 found a solution to this, having the same issue.

You should launch the xcode ,and select /platform/ios/xxxx.xcodeproj path and build on ur iphone or launch the simulator , and run the terminal ,then it works

1/ i opened the xcode.
2/ what do you mean by " select /platform/ios/xxxx.xcodeproj path and build"

FYI, i am also having same issue. i tried from my both of my macbook. This looks bigger issue, appreciate any help fixing this issue.
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT: no such file or directory, stat '/Users/naab/Library/Logs/CoreSimulator/0C2081C0-61B6-4A33-A5FB-28F2177E7334/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/naab/WORK_APP/myApp/platforms/ios/build/emulator/myApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/naab/WORK_APP/myApp/platforms/ios/cordova/console.log,--stdout,/Users/naab/WORK_APP/myApp/platforms/ios/cordova/console.log,--exit
Error: /Users/naab/WORK_APP/myApp/platforms/ios/cordova/run: Command failed with exit code 2

Ok this is what worked for me.

  1. Uninstall/ Fresh Install Xcode.
  2. Follow this guide to use npm without sudo:
    http://www.johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/
  3. run: npm -g install ios-sim

Anyone got an answer for this -
So far : Installed node4, Xcode, agreed the terms, downloaded the iOS 9.1 simulator package and check the command line tools via the terminal. Got the exact same problem as Quesel.
I tried fresh install of Xcode and xcode-select --install, done all the above, restarted machine but still the same error on calling ionic emulate ios. Any suggestions?

Thanks oneboxteam - That worked perfectly.
:-)

Thanks @oneboxteam - that worked for me too

Used @oneboxteam link to solved it :+1:

@oneboxteam :+1:

@oneboxteam's link didn't work for me. But running "ionic state reset" did.

Hi all,

Have tried everything in this thread and still getting the same issue ... I can open up the project in xcode and run the emulator from there and everything works great. I cannot, however, open the emulator from the terminal with ionic emulate ios ... when i do run ionic emulate ios i get

** BUILD SUCCEEDED **

the emulator opens but is just a black screen
and then after a while the terminal logs

No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state

here is my ionic info

ordova CLI: 6.0.0
Gulp version:  CLI version 3.9.0
Gulp local:
Ionic Version: 1.2.4
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
Node Version: v4.0.0
Xcode version: Xcode 7.2.1 Build version 7C1002

Anyone else seeing behavior like this or have any ideas? Would be much appreciated!

@BenjaminConant I'm seeing the same issue, the emulator doesn't start properly. The project seems to build, then starts a blank window, and after a while the console exits with:

No target specified for emulator. Deploying to iPhone-6s-Plus, 9.3 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
Error: ENOENT: no such file or directory, stat '/Users/[username]/Library/Logs/CoreSimulator/8776EAE5-33FF-40FC-B75D-4204851C010E/system.log'

Recursive chowning hasn't helped, nor sudo npm installing ios-sim and ios-deploy. Given it's a first run for me on ios development, it might be that I'm just missing something, or it could be a real issue for the few of us.

FYI running an emulator through xcode, and then doing ionic emulate ios worked for me.

In more detail: I made a hello world project and ran it in the emulator, then went to the command line and ran ionic emulate ios, after which the emulator switched to my app. Not ideal, but works..

Thank you so much @oneboxteam, the link helped me to solve the issue.

Hi All,

I have resolve this issue by re install node.
First I uninstall node which used node-vx.x.x-pkg to install. And uninstall all npm packages.
Then use brew install node to install it. And re install cordova, ionic.
Now I can use ionic emulate ios to start my emulator and test my app.

I suppose the reason is permission denied.
Because in the previous, create, build, emulate ionic app, I need add sudo command.
Now needn't.

Hope to have this kind of problem a few ideas.

Alright guys, I went through _all_ of these suggestions and none of them helped me. For those unlucky few that still get

No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state

Open your Xcode project, then run it on the iPhone 6 emulator. After doing that step, I was able to use ionic emulate ios and ionic emulate ios -lcs ಠ_ಠ

hey guys!

I have the same problem when I try to emulate iOS platform

* BUILD SUCCEEDED *

No target specified for emulator. Deploying to iPhone-SE, 10.0 simulator

An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=163):
Invalid device state

An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=163):
Invalid device state

Error: ENOENT: no such file or directory, stat '/Users/Leith/Library/Logs/CoreSimulator/81DA68A9-07E9-4202-B985-8D9B106F458E/system.log'

bash-3.2#

I tried to looking for any solution about this..but I can't find something good.

Any idea?
Thanks!

@LeithOscar have you run npm -g install ios-sim?

FIGURED IT OUT! NVM USERS READ none of these things seemed to help. Something that i should have thrown into the equation was that i was using NVM (node version manager) and i don't think i'm the only one. I used a different node version within NVM and reinstalled cordova and ionic. I DID NOT install ios-dim or ios-deploy... and it worked perfectly. So i've come to the conclusion that i need to completely delete the old node version i was using and reinstall everything and it will work on whatever version i need.

I fixed by "Reset content and settings" on simulator

Having the same problem, and no solution found after read the whole thread.

¿Any help?

I have the same problem.

None of below solutions work for me:

  1. I have installed latest ios-sim and ios-deploy
  2. I don't have nvm
  3. I have tried chmod -R on whole HOME folder ~/
  4. I have removed and added ios platform several times now.

I am seeing only black screen when running emulator. And also the emulator that is run is the last emulatot/simulator I have run from xcode. iOS simulator ignores any parameters for cordova emulate or ionic emulate. Always the same device is started (iPhone 6s).

The link solved the problem for me.
http://zacvineyard.com/blog/2015/11/ionic-invalid-device-state-error-with-xcode-7-solved

In short: be sure to
DO NOT RUN
sudo cordova run ios
BUT RUN
cordova run ios

If the build fails you probably have to give the permission to your normal user to read/write the ios platform files, doing:

sudo chmod -R 777 /<your- app-path>/platforms/ios/

This way you can go with the CLI, no need to open Xcode.

I had this problem with both Ionic and React-Native, it looks like this is framework-independent problem.

Solution in this link solved that for me (ignore the fact that it's react-native):
http://stackoverflow.com/questions/38293243/react-native-build-succeed-but-no-devices-are-booted

To sum up:

  1. Run maunally from xcode simulator that you want
  2. Reset Content and Settings in the simulator
  3. run cordova run ios --target="[the phone you have launched manually]"

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings