1
votes

I have an issue when running the following cordova command to emulate my application in the iOS Simulator

sudo cordova emulate ios    

Once I run this - the simulator opens up but nothing appears to install and I get the error log below in the terminal.

NOTE - When I use the cordova emulate android - it works perfectly! So its only gives me a problem with the iOS Simulator

My setup is below:

OS: Mac OS X Yosemite
Node Version: v0.12.2
Cordova CLI: 5.0.0
Ionic CLI Version: 1.3.22
Xcode version: Xcode 6.3.1 Build version 6D1002
ios-sim version: 3.1.1
ios-deploy version: 1.5.0 

The terminal returns the following after I execute the emulate command.

** BUILD SUCCEEDED **

No target specified for emulator. Deploying to iPhone-6 simulator 2015-05-12 16:53:47.185 ios-sim[10744:146495] stderrPath: /Users/myusername/Documents/mobileapps/myApp/platforms/ios/cordova/console.log 2015-05-12 16:53:47.185 ios-sim[10744:146495] stdoutPath: /Users/myusername/Documents/mobileapps/myApp/platforms/ios/cordova/console.log Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Timed out waiting for device to boot" UserInfo=0x7ff56375b580 {NSLocalizedDescription=Timed out waiting for device to boot} Error code 1 for command: ios-sim with args: launch,/Users/myusername/Documents/mobileapps/myApp/platforms/ios/build/emulator/myApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/myusername/Documents/mobileapps/myApp/platforms/ios/cordova/console.log,--stdout,/Users/myusername/Documents/mobileapps/myApp/platforms/ios/cordova/console.log,--exit Error: /Users/myusername/Documents/mobileapps/myApp/platforms/ios/cordova/run: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) at ChildProcess.emit (events.js:110:17) at maybeClose (child_process.js:1015:16) at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

2

2 Answers

1
votes

stop using sudo!

When you do the build folder gets owned by root and the cli command can't verify the emulator is up.

Recreate the ionic project without using sudo.

1
votes

Just change the permission of the working directory and run again.

sudo chown -Rv "username" "directory_of_cordova_project"

Now, either can launch the Xcode project directly or use the command "sudo cordova emulate ios"