ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

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

Open Quesle opened this issue 11 years ago • 38 comments

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?

Quesle avatar Nov 23 '15 13:11 Quesle

OK, I will re submit this issue. Thanks.

Quesle avatar Nov 23 '15 13:11 Quesle

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.

mhartington avatar Nov 23 '15 15:11 mhartington

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

Quesle avatar Nov 24 '15 13:11 Quesle

So does that fix the issue?

mhartington avatar Nov 24 '15 15:11 mhartington

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

jeswinjose avatar Nov 29 '15 08:11 jeswinjose

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

nabn avatar Dec 01 '15 18:12 nabn

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.

mlynch avatar Dec 06 '15 00:12 mlynch

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

donedgardo avatar Jan 02 '16 00:01 donedgardo

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

2857 avatar Jan 05 '16 02:01 2857

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

naaab avatar Jan 13 '16 04:01 naaab

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

donedgardo avatar Jan 13 '16 05:01 donedgardo

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?

catgsmith avatar Jan 26 '16 10:01 catgsmith

Solved it with : http://zacvineyard.com/blog/2015/11/ionic-invalid-device-state-error-with-xcode-7-solved

oneboxteam avatar Jan 28 '16 09:01 oneboxteam

Thanks oneboxteam - That worked perfectly. :-)

catgsmith avatar Jan 28 '16 10:01 catgsmith

Thanks http://zacvineyard.com/blog/2015/11/ionic-invalid-device-state-error-with-xcode-7-solved it worked like a charm

AmbarishKr avatar Feb 03 '16 20:02 AmbarishKr

Thanks @oneboxteam - that worked for me too

iscott avatar Feb 09 '16 18:02 iscott

Used @oneboxteam link to solved it :+1:

ndelvalle avatar Feb 12 '16 00:02 ndelvalle

@oneboxteam :+1:

jgatjens avatar Feb 12 '16 01:02 jgatjens

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

tomsharon avatar Mar 03 '16 08:03 tomsharon

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 avatar Mar 16 '16 17:03 BenjaminConant