xcode 模拟器使用离子显示黑屏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26014035/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:41:03  来源:igfitidea点击:

Simulator shows Black screen using ionic

iosxcodecordovaios-simulatorionic-framework

提问by sh4hin

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

当我运行 emulate ios 时,我经历了 ionic sidemenu 应用程序,但出现以下错误:

 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

这些是我的 mac 信息: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

回答by sh4hin

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

我终于找到了解决此问题的解决方案 首先设置您的应用程序:

1- ionic start myAppname tabs

1- ionic 启动 myAppname 选项卡

2- cd myAppname

2- cd myAppname

3- ionic platform add iOS

3-ionic平台添加iOS

4- ionic build ios

4-离子构建ios

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

然后在您的项目目录中创建一个名为 emulator.sh 或任何名称的文件并复制以下代码的内容:

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

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

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

为脚本设置权限:$sudo chmod 777 emulator.sh

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

每当你想模拟你的应用程序时,运行脚本:./emulator.sh

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

因此,通过使用此脚本,您无需在 Xcode 中手动打开项目并运行该项目

special thanks to Miroslav Masa

特别感谢 Miroslav Masa

回答by akatov

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

您是否在tmux会话中运行 ionic 命令?tmux 似乎阻止了cordova 和iOS 模拟器之间的通信。当我尝试ionic/cordova emulate ios直接从终端运行命令时,它运行得很好!

回答by brianrhea

I was having the same issue and was able to resolve it by:

我遇到了同样的问题,并且能够通过以下方式解决它:

  • Open Xcode
  • In the Xcode > Open Developer Tool > iOS Simulator
  • iOS Simulator > Reset Content and Settings
  • Restart Mac (uncheck open all windows)
  • 打开 Xcode
  • 在 Xcode > Open Developer Tool > iOS Simulator
  • iOS 模拟器 > 重置内容和设置
  • 重新启动 Mac(取消选中打开所有窗口)

Godspeed.

神速。

回答by Stone

You have to manually copy over the latest ionic files into your project after unzipping them as noted here: http://forum.ionicframework.com/t/on-upgrading-to-ionic-beta-13-getting-error-uncaught-referenceerror-interpolate-is-not-defined/10232

解压后,您必须手动将最新的离子文件复制到您的项目中,如下所示:http: //forum.ionicframework.com/t/on-upgrading-to-ionic-beta-13-getting-error-uncaught-参考错误插值未定义/10232