Simulator session timed out when ran `ionic emulate ios`

Hey guys,
I tried googling a lot for the below mentioned error but could not find any help. If anyone can provide any help, that would be great.

I ran the following command:

sudo ionic emulate ios

And the build succeeded, but got this error:

Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x7fef73f001e0 {NSLocalizedDescription=Simulator session timed out.}
Error:<directory_name>/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:735:16)
    at Process.ChildProcess._handle.onexit (child_process.js:802:5)

Also, I saw EACCES issues when ran ionic emulate ios without sudo command. And therefore, ran the command with sudo.

I’m using the following ionic version:

1.2.8

By default, XCode uses iOS 8 simulator and the simulator opened with a black screen but session could not be connected. I also downloaded iOS 7.1 simulator but even that did not work.

Any ideas what could be going wrong here?
Please let me know if anyone needs more info.

Thanks!

Hello,

This worked for me… see my response:

This has happened to me on and off. My solution has been to just run XCode, load the project and run the simulator from there.

my solution is based on the same observation of ability to run the app in XCode…
there is some serious issue regarding permissions of project files or the path to the *.app is set wrongly in ‘emulate’ command, so actually what happens, the simulator is not getting correct file, and by trying to open it, it waits and waits till it timeout. That’s just my assumption.

That will be the case. I have lot of troubles with access rights in a cordova project. After a android build I have to change access rights for some IOS directories to build IOS in Xcode . Access rights like owner etc are a bridge to far away for me. I did some correction found in forums about this and ran into more problems. If there is a good solution how to deal with access right I would be very happy.

Hey, I’ve been stuck with this issue too, trying to follow the “getting started” guide. The only thing that got my ios-sim to work was the emulator.sh script shared by miro

I found out this was related to permissions. If my user was the owner of everything in the folder, it worked fine.

The actual solution for my problem was quite simple: just DO NOT USE SUDO for anything. Don’t create the project with it (ignore the cordova warning), dont add the ios platform with it, don’t build with it, don’t emulate with it.

To fix a project started with this problem, just run:

sudo chown -R [username] [projectfolder]
# where [username] is the actual name of your osx user

give it a try and let me know.