Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulator shows Black screen using ionic

i went through ionic sidemenu app when i run emulate ios i get these errors:

 Usage of '--family' is deprecated in 3.x. Use --devicetypeid instead.
 Usage of '--retina' is deprecated in 3.x. Use --devicetypeid instead.
 Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator          session timed out." UserInfo=0x7f91f97358b0 {NSLocalizedDescription=Simulator session timed

and the black screen comes for the simulator

and these are my mac info: yosemite 10.10 ios-sim version 3.0.0 cordova version 3.6.3-0.2.13 ionic version 1.2.6-beta1 xcode 6.1

like image 337
sh4hin Avatar asked Sep 24 '14 10:09

sh4hin


2 Answers

I finally found a solution to fix this problem First setup your application:

1- ionic start myAppname tabs

2- cd myAppname

3- ionic platform add iOS

4- ionic build ios

Then create a file in your projects directory called emulator.sh or whatever name and copy the content of the code below:

echo "Emulating..."
cd ./platforms/ios/build/emulator
var=$(pwd)

ios-sim launch "$var"/*.app

Set permission for the script: $sudo chmod 777 emulator.sh

whenever you want to emulate your application run the script: ./emulator.sh

so by using this script you don't need to manually open the project in Xcode and run the project

special thanks to Miroslav Masa

like image 83
sh4hin Avatar answered Sep 19 '22 18:09

sh4hin


Are you running the ionic command from inside a tmux session? tmux seems to be preventing the communication between cordova and the iOS simulator. As soon as I tried running the ionic/cordova emulate ios commands directly from the terminal, it worked just fine!

like image 42
akatov Avatar answered Sep 20 '22 18:09

akatov