Running cordova emulate ios problem


#1

I did try to emulate the project ionic-angular-cordova-seed-master but the ios emulator don’t appear after I enter the commad: cordova emulate ios. , i.e, nothing happens.

> duly-imac:ionic-angular-cordova-seed-master eldontc$ pwd
> /dados-usr/trabalho/ionic-angular-cordova-seed-master
> duly-imac:ionic-angular-cordova-seed-master eldontc$ ls
> LICENSE		README.md	platforms	plugins		www
> duly-imac:ionic-angular-cordova-seed-master eldontc$ sudo cordova platform add ios
> Creating ios project...
> Preparing ios project
> duly-imac:ionic-angular-cordova-seed-master eldontc$ sudo cordova build ios
> Generating config.xml from defaults for platform "ios"
> Preparing ios project
> Compiling app on platform "ios" via command "/dados-usr/trabalho/ionic-angular-cordova-seed-master/platforms/ios/cordova/build" 
> Platform "ios" compiled successfully.
> duly-imac:ionic-angular-cordova-seed-master eldontc$ sudo cordova emulate ios
> Generating config.xml from defaults for platform "ios"
> Preparing ios project
> Running on emulator for platform "ios" via command "/dados-usr/trabalho/ionic-angular-cordova-seed-master/platforms/ios/cordova/run" --emulator

#2

I just delete de directory plataform/ios and run cordova build ios .
After this, when I run the command cordova emulate ios, the following error occurs:

uly-imac:aaclient eldontc$ sudo cordova emulate ios
Password:
Generating config.xml from defaults for platform "ios"
Preparing ios project
Running on emulator for platform "ios" via command "/dados-usr/trabalho/aaclient/aaclient/platforms/ios/cordova/run" --emulator
Error: An error occurred while emulating/deploying the ios project. ** BUILD FAILED **


The following build commands failed:
	Check dependencies
(1 failure)
2014-02-18 00:23:38.074 ios-sim[7553:707] stderrPath: /dados-usr/trabalho/aaclient/aaclient/platforms/ios/cordova/console.log
2014-02-18 00:23:38.075 ios-sim[7553:707] stdoutPath: /dados-usr/trabalho/aaclient/aaclient/platforms/ios/cordova/console.log
Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x7f7f99442250 {NSLocalizedDescription=Simulator session timed out.}

    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cordova/src/emulate.js:67:22)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

#3

Hmm, so in the first example it says Running on emulator for platform "ios" via command "/dados-usr/trabalho/ionic-angular-cordova-seed-master/platforms/ios/cordova/run" --emulator but nothing happens? Strange.

What happens if you try without sudo?

Also after deleting platform/ios, did you do cordova platform add ios again?

EDIT: Looking into it a little more, what does ios-sim -version give you? And what version of Cordova are you using?


#4

I found a solution. But I don’t know if this solution is correct.
Before I run the command cordova emulate ios, I did need start XCode application and start a emulator from it. Then, when I run cordova emulate ios the XCode application was invoked and the emulator appears.
In this page, the instructions isn’t so clear about this: https://cordova.apache.org/docs/en/2.9.0/guide_cli_index.md.html

Is this method correct? Do I must execute XCode’s emulator before?

duly-imac:ios eldontc-std$ ios-sim --version
1.8.2
duly-imac:ios eldontc-std$ cordova platform add ios
Platform ios already added
duly-imac:ios eldontc-std$ cordova emulate ios
Generating config.xml from defaults for platform "ios"
Preparing ios project
Running on emulator for platform "ios" via command "/dados-usr/trabalho/music-all/platforms/ios/cordova/run" --emulator
Platform "ios" deployed to emulator.
duly-imac:ios eldontc-std$ 

#5

nope. which cordova version do you have? And you run on mavericks?


#6

@Ciraxis

My cordova version is 3.3.1-0.3.1 and I’m not run on Mavericks, but on Mountain Lion, 10.8.5.

duly-imac:ios eldontc-std$ cordova -version
3.3.1-0.3.1 

#7

hm if you try platforms/ios/cordova/run --emulator it fire up the emulator via command line?


#8

I did try

The results are:

** BUILD FAILED **


The following build commands failed:
	Check dependencies
(1 failure)
2014-02-24 17:19:10.279 ios-sim[28033:707] stderrPath: /dados-usr/trabalho/music-all/platforms/ios/cordova/console.log
2014-02-24 17:19:10.280 ios-sim[28033:707] stdoutPath: /dados-usr/trabalho/music-all/platforms/ios/cordova/console.log
Could not start simulator session: Error Domain=DTiPhoneSimulatorErrorDomain Code=5 "Operation failed with underlying error 4294956486." UserInfo=0x7f9243a02370 {NSLocalizedDescription=Operation failed with underlying error 4294956486., NSUnderlyingError=0x7f9242c1d940 "The operation couldn’t be completed. (OSStatus error -10810.)"}

#9

thats weird… ios-sim is installed?


#10

Is it possible it’s something like this: http://stackoverflow.com/a/16739338/1091751 ?

My other thought is that since you ran everything as sudo perhaps permissions somewhere got screwed up? AFAIK you won’t need to run as root for anything cordova related, perhaps try cleaning out the project directory and re-installing without sudo or taking a look at the project permissions?


#11

Thanks Tim, I happened upon this thread for similar reasons and the sudo thing did it for me.


#12

Just thought I’d add in my recent experience with a similar error. Turns out it was due to my running in a tmux session.


#13

This fixed the problem for me:

  1. Open simulator directly
  2. From the menu: iOS Simulator -> Reset Content and Settings… then hit Reset
  3. re-run your project

#14

Seems like I had same problem. Make sure you have access rights to your project folder and to all it’s nested objects.
Granting read/write permissions to myself fixed this issue for me.


#15

Running into this issue after first installation - iOS Simulator failed to install the application.
I tried resetting simulator content and settings but that didnt help. Any thoughts?


2014-08-29 14:57:19.517 ios-sim[39077:707] stderrPath: /Users/asuryanarayana/Desktop/EDOC/willowOne/platforms/ios/cordova/console.log
2014-08-29 14:57:19.518 ios-sim[39077:707] stdoutPath: /Users/asuryanarayana/Desktop/EDOC/willowOne/platforms/ios/cordova/console.log
Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 “iOS Simulator failed to install the application.” UserInfo=0x7f91a4909620 {NSLocalizedDescription=iOS Simulator failed to install the application., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}
Error: /Users/asuryanarayana/Desktop/EDOC/willowOne/platforms/ios/cordova/run: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)


#16

To me it happens on device, not in the emulator…


#17

In my case it was sudo ing the iOS add caused the issue. do this,

  1. sudo cordova platform rm ios
  2. cordova platform add ios
  3. build and emulate

Do not add the platform with sudo!


#18

I installed this as myself (not as root), and ppm’s solution did the trick. Thanks!


#19

This worked a treat for me :smile:

Then to emulate:
cordova emulate ios


#20

Wow. Running in standard term instead of tmux - fixed error for me. Thanks.