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

Thanks man this link saved the day!!! http://zacvineyard.com/blog/2015/11/ionic-invalid-device-state-error-with-xcode-7-solved

Darvile avatar Apr 02 '16 10:04 Darvile

@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 avatar Jun 07 '16 13:06 eyeinsky

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 avatar Jun 08 '16 08:06 eyeinsky

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

jacprada avatar Jun 10 '16 15:06 jacprada

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 avatar Jul 25 '16 07:07 Quesle

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 avatar Aug 16 '16 17:08 samcdavid

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 avatar Sep 27 '16 17:09 LeithOscar

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

jgatjens avatar Sep 27 '16 20:09 jgatjens

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.

spencer1573 avatar Nov 24 '16 17:11 spencer1573

I fixed by "Reset content and settings" on simulator

phuongpt avatar Dec 06 '16 03:12 phuongpt

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

¿Any help?

edu-aguilar avatar Dec 12 '16 10:12 edu-aguilar

https://forum.ionicframework.com/t/error-enoent-no-such-file-or-directory-stat-var-root-library-logs-coresimulator-1a2f74cf-a3f0-422e-bdb0-9188409f7529-system-log/72775

ghost avatar Dec 15 '16 02:12 ghost

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 avatar Jan 11 '17 17:01 mcwienczek

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.

jackie-d avatar Feb 22 '17 18:02 jackie-d

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 avatar May 17 '17 16:05 mcwienczek

  • This is because of sudo, Don't use sudo
  • Just open a fresh terminal and run below command 'sudo chown -v -R -L yourUserName /pathtoYourApp'
  • Now run 'ionic cordova run ios --target="[your phone choice]" '
  • To list all cordova devices run 'ionic cordova run ios --list' Ref or Credits : http://zacvineyard.com/blog/2015/11/ionic-invalid-device-state-error-with-xcode-7-solved Cheers!

sreekanth-karini avatar Aug 18 '17 12:08 sreekanth-karini

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.

ionitron-bot[bot] avatar Sep 02 '18 06:09 ionitron-bot[bot]