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

Closed
Quesle opened this Issue Nov 23, 2015 · 38 comments

Comments

Projects
None yet
@Quesle

Quesle commented Nov 23, 2015

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 Quesle changed the title from BUG can't open ios simulator with xcode 7 to bug: BUG can't open ios simulator with xcode 7 Nov 23, 2015

@Quesle

This comment has been minimized.

Show comment
Hide comment
@Quesle

Quesle Nov 23, 2015

OK, I will re submit this issue.
Thanks.

Quesle commented Nov 23, 2015

OK, I will re submit this issue.
Thanks.

@Quesle Quesle closed this Nov 23, 2015

@Quesle Quesle reopened this Nov 23, 2015

@mhartington

This comment has been minimized.

Show comment
Hide comment
@mhartington

mhartington Nov 23, 2015

Member

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.

Member

mhartington commented Nov 23, 2015

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.

@Quesle

This comment has been minimized.

Show comment
Hide comment
@Quesle

Quesle Nov 24, 2015

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

Quesle commented Nov 24, 2015

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

@Ionitron Ionitron removed the needs reply label Nov 24, 2015

@mhartington

This comment has been minimized.

Show comment
Hide comment
@mhartington

mhartington Nov 24, 2015

Member

So does that fix the issue?

Member

mhartington commented Nov 24, 2015

So does that fix the issue?

@jeswinjose

This comment has been minimized.

Show comment
Hide comment
@jeswinjose

jeswinjose Nov 29, 2015

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

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

@nabn

This comment has been minimized.

Show comment
Hide comment
@nabn

nabn Dec 1, 2015

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

nabn commented Dec 1, 2015

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

@mlynch

This comment has been minimized.

Show comment
Hide comment
@mlynch

mlynch Dec 6, 2015

Member

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.

Member

mlynch commented Dec 6, 2015

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 mlynch closed this Dec 6, 2015

@donedgardo

This comment has been minimized.

Show comment
Hide comment
@donedgardo

donedgardo Jan 2, 2016

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

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

@2857

This comment has been minimized.

Show comment
Hide comment
@2857

2857 Jan 5, 2016

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 commented Jan 5, 2016

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

@naaab

This comment has been minimized.

Show comment
Hide comment
@naaab

naaab Jan 13, 2016

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 commented Jan 13, 2016

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

@donedgardo

This comment has been minimized.

Show comment
Hide comment
@donedgardo

donedgardo Jan 13, 2016

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

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
@catgsmith

This comment has been minimized.

Show comment
Hide comment
@catgsmith

catgsmith Jan 26, 2016

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?

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

This comment has been minimized.

Show comment
Hide comment
@catgsmith

catgsmith Jan 28, 2016

Thanks oneboxteam - That worked perfectly.
:-)

Thanks oneboxteam - That worked perfectly.
:-)

@iscott

This comment has been minimized.

Show comment
Hide comment
@iscott

iscott Feb 9, 2016

Thanks @oneboxteam - that worked for me too

iscott commented Feb 9, 2016

Thanks @oneboxteam - that worked for me too

@ndelvalle

This comment has been minimized.

Show comment
Hide comment
@ndelvalle

ndelvalle Feb 12, 2016

Used @oneboxteam link to solved it 👍

Used @oneboxteam link to solved it 👍

@jgatjens

This comment has been minimized.

Show comment
Hide comment
@tomsharon

This comment has been minimized.

Show comment
Hide comment
@tomsharon

tomsharon Mar 3, 2016

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

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

@BenjaminConant

This comment has been minimized.

Show comment
Hide comment
@BenjaminConant

BenjaminConant Mar 16, 2016

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!

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!

@Darvile

This comment has been minimized.

Show comment
Hide comment
@eyeinsky

This comment has been minimized.

Show comment
Hide comment
@eyeinsky

eyeinsky Jun 7, 2016

@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.

eyeinsky commented Jun 7, 2016

@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.

@eyeinsky

This comment has been minimized.

Show comment
Hide comment
@eyeinsky

eyeinsky Jun 8, 2016

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..

eyeinsky commented Jun 8, 2016

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..

@jacprada

This comment has been minimized.

Show comment
Hide comment
@jacprada

jacprada Jun 10, 2016

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

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

@Quesle

This comment has been minimized.

Show comment
Hide comment
@Quesle

Quesle Jul 25, 2016

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.

Quesle commented Jul 25, 2016

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.

@samcdavid

This comment has been minimized.

Show comment
Hide comment
@samcdavid

samcdavid Aug 16, 2016

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 ಠ_ಠ

samcdavid commented Aug 16, 2016

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 ಠ_ಠ

@LeithOscar

This comment has been minimized.

Show comment
Hide comment
@LeithOscar

LeithOscar Sep 27, 2016

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!

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!

@jgatjens

This comment has been minimized.

Show comment
Hide comment
@jgatjens

jgatjens Sep 27, 2016

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

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

@spencer1573

This comment has been minimized.

Show comment
Hide comment
@spencer1573

spencer1573 Nov 24, 2016

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.

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.

@phuongpt

This comment has been minimized.

Show comment
Hide comment
@phuongpt

phuongpt Dec 6, 2016

I fixed by "Reset content and settings" on simulator

phuongpt commented Dec 6, 2016

I fixed by "Reset content and settings" on simulator

@edu-aguilar

This comment has been minimized.

Show comment
Hide comment
@edu-aguilar

edu-aguilar Dec 12, 2016

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

¿Any help?

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

¿Any help?

@mcwienczek

This comment has been minimized.

Show comment
Hide comment
@mcwienczek

mcwienczek Jan 11, 2017

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).

mcwienczek commented Jan 11, 2017

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).

@giacomodeglinnocenti

This comment has been minimized.

Show comment
Hide comment
@giacomodeglinnocenti

giacomodeglinnocenti Feb 22, 2017

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.

giacomodeglinnocenti commented Feb 22, 2017

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.

@mcwienczek

This comment has been minimized.

Show comment
Hide comment
@mcwienczek

mcwienczek May 17, 2017

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]"

mcwienczek commented May 17, 2017

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]"
@sreekanth-karini

This comment has been minimized.

Show comment
Hide comment
@sreekanth-karini

sreekanth-karini Aug 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment