简体   繁体   English

Xcode beta 6 iOS 8:模拟器不工作

[英]Xcode beta 6 iOS 8: Simulator not working

I cannot launch the simulator successfully.我无法成功启动模拟器。 Once I launch the IOS Simulator this error appears:一旦我启动 IOS 模拟器,就会出现此错误:

"Unable to boot the IOS Simulator." “无法启动 IOS 模拟器。”

Following the IOS Simulator error, I then get an error from Xcode reading:在 IOS 模拟器错误之后,我从 Xcode 读取中得到一个错误:

Unable to run app in Simulator无法在模拟器中运行应用程序
An error was encountered while running (Domain = DTiPhoneSimulatorErrorDomain, Code = 2)运行时遇到错误 (Domain = DTiPhoneSimulatorErrorDomain, Code = 2)

错误截图

UPDATE:更新:

This might sound silly but I went to Xcode/preference/Downloads with intentions of seeing a IOS 8.0 Simulator but there was none.这听起来可能很傻,但我去 Xcode/preference/Downloads 是想看看 IOS 8.0 模拟器,但没有。 Could this be the problem?这可能是问题吗? Am I suppose to have a IOS 8.0 Simulator?我应该有一个 IOS 8.0 模拟器吗? If so can someone direct me how to get it?如果是这样,有人可以指导我如何获得它吗? Also, under the "Downloads" tab in Xcode preference I do see IOS 7.0 and 7.1 Simulators and both work fine with Xcode 5.此外,在 Xcode 首选项的“下载”选项卡下,我确实看到了 IOS 7.0 和 7.1 Simulators,并且它们都可以与 Xcode 5 一起正常工作。

the trick is, to select the right command line tools!诀窍是,选择正确的命令行工具! just select it here只需在此处选择它在此处输入图片说明

reboot (!) and everything is fine again :-)重新启动(!),一切又好了:-)

Ok It's known problem.好的,这是已知问题。 Do you see simulators list?你看到模拟器列表了吗? If not如果不

Goto Xcode Menu -> Open Developer Tool -> It will open a simulator in your Dock -> click on simulator then go to Simulator Menu: Hardware -> Device -> Manage Devices.转到 Xcode 菜单 -> 打开开发者工具 -> 它将在你的 Dock 中打开一个模拟器 -> 单击模拟器然后转到模拟器菜单:硬件 -> 设备 -> 管理设备。 Add needed simulators.添加所需的模拟器。 Always try to run your app with different simulators.someone will work.总是尝试用不同的模拟器运行你的应用程序。有人会工作的。

Restart your Mac.重新启动您的 Mac。 I just had that exact error after installing Xcode 6 beta 7, literally the only thing I did in response was reboot my Mac and now the iOS 8 simulator is working.在安装 Xcode 6 beta 7 后,我刚刚遇到了那个确切的错误,实际上我所做的唯一回应就是重新启动我的 Mac,现在 iOS 8 模拟器正在运行。

This error is common if you update Xcode without restarting afterwards.如果您更新 Xcode 之后没有重新启动,则此错误很常见。

In my case, i reset ios simulator settings fix it.就我而言,我重置了 ios 模拟器设置来修复它。

iOS Simulator -> Reset Content and Settings ... iOS 模拟器 -> 重置内容和设置...

  1. Open Xcode 6 beta打开 Xcode 6 测试版
  2. Goto Window > Devices转到窗口 > 设备
  3. Click on the little + sign at the bottom点击底部的小+号
  4. Add (if missing) all the devices that you want, or delete and recreate if not working.添加(如果缺少)您想要的所有设备,或者如果不起作用则删除并重新创建。
  5. If anyone of the simulator is not working then you can delete it and then re-create it again in this menu.如果模拟器中的任何一个不工作,那么您可以将其删除,然后在此菜单中重新创建它。

在此处输入图片说明

I saw the same issue when I installed Xcode 6 beta 6, and deleted beta 4 and beta 5. Apparently, deleting the old betas also deleted the iOS Simulator 8 versions!我在安装 Xcode 6 beta 6 时看到了同样的问题,并删除了 beta 4 和 beta 5。显然,删除旧的 beta 也删除了 iOS Simulator 8 版本! Putting it back from my Trash solved the issue.把它从我的垃圾箱里放回去解决了这个问题。

Solution: Don't delete old beta software!解决方案:不要删除旧的测试版软件!

Edit: @Flori's solution worked.编辑:@Flori 的解决方案有效。 Was able to delete the old beta software, and after a complete system reboot, it worked again.能够删除旧的测试版软件,并在完全重新启动系统后,它再次工作。

  • From the xCode 6 pull down menus, Xcode > Open Developer Tool > iOS Simulator (if you get a pop up error just dismiss it)从 xCode 6 下拉菜单中,Xcode > Open Developer Tool > iOS Simulator(如果出现弹出错误,请关闭它)
  • Once in the Simulator go to Hardware > Device > Manage Devices.进入模拟器后,转到硬件 > 设备 > 管理设备。
  • Delete everything listed under simulator.删除模拟器下列出的所有内容。
  • Reboot your machine.重新启动您的机器。

After that, navigate back to Manage Devices in the simulator and click the plus to add back your simulators.之后,导航回模拟器中的管理设备,然后单击加号以重新添加您的模拟器。 Then the iOS 8 simulators will show up.然后将显示 iOS 8 模拟器。

Just unset DYLD_INSERT_LIBRARIES environment variable in the /etc/launchd.conf or ~/.launchd.conf file.只需在 /etc/launchd.conf 或 ~/.launchd.conf 文件中取消设置 DYLD_INSERT_LIBRARIES 环境变量。 Which you can edit by sudo vi /etc/launchd.conf command.您可以通过 sudo vi /etc/launchd.conf 命令进行编辑。 remove the above flag save it by "ZZ" (captial Z) and reboot the system.删除上面的标志,用“ZZ”(大写Z)保存并重新启动系统。 It works like a charm.它就像一个魅力。

Make sure that path in menu XCode>Preference>Locations point to XCode 6.0 (Restart Xcode after changing them).确保菜单 XCode>Preference>Locations 中的路径指向 XCode 6.0(更改它们后重新启动 Xcode)。 Then go to menu Window>Devices and add simulator devices you want to use.然后转到菜单窗口>设备并添加您要使用的模拟器设备。

I got this issue when moving from Beta 6 to Beta 7. Very frustrating.从 Beta 6 迁移到 Beta 7 时,我遇到了这个问题。非常令人沮丧。 I could reset content and settings on any of the iOS 8 simulators.我可以在任何 iOS 8 模拟器上重置内容和设置。 None of my iOS 8 simulators were working at all, just a black screen.我的 iOS 8 模拟器根本没有工作,只是黑屏。 I restarted my machine during the process, but I am not sure if it did anything.我在这个过程中重新启动了我的机器,但我不确定它是否做了什么。 Initially I had only iOS 8 Simulators.最初我只有 iOS 8 模拟器。 I had to remove and reinstall Xcode6Beta7.我不得不删除并重新安装 Xcode6Beta7。 I did not get the Install More Components the first time I installed it, I am not sure if that was the missing part.我第一次安装时没有安装更多组件,我不确定那是不是缺少的部分。 I installed the iOS 7 Simulators from Settings->Downloads because my iOS8 ones were not working.我从“设置”->“下载”安装了 iOS 7 模拟器,因为我的 iOS8 模拟器无法正常工作。 After I had reinstalled and relaunched the simulator, I then had a list of iOS 6,7,& 8 simulators.在我重新安装并重新启动模拟器后,我得到了一个 iOS 6、7 和 8 模拟器列表。 None of the iOS 8 Simulators were working.没有一个 iOS 8 模拟器在工作。 I was able to launch the iOS7 simulator and then using the device menu change to an iOS 8 Simulator.我能够启动 iOS7 模拟器,然后使用设备菜单更改为 iOS 8 模拟器。 Some still did not work, I had to remove them and re-add them in the devices screen.有些仍然不起作用,我不得不删除它们并在设备屏幕中重新添加它们。

  1. Remove XCode6Beta from Applications.从应用程序中删除XCode6Beta
  2. Restart Machine (Just in case, this seems to solve some peoples issue completely)重启机器(以防万一,这似乎完全解决了一些人的问题)
  3. Install XCode6Beta .安装XCode6Beta
  4. Verify the Install Additional Components ran.验证安装附加组件已运行。
  5. Launch Xcode6Beta.启动 Xcode6Beta。
  6. Preferences->General->Change Command Line Tools to Xcode 6.0.首选项-> 常规-> 将命令行工具更改为 Xcode 6.0。
  7. Restart Xcode .重新启动Xcode
  8. Preferences->Downloads->Download iOS 7 Simulator (If not already downloaded). Preferences->Downloads->Download iOS 7 Simulator(如果尚未下载)。
  9. Run App on iOS 7 Simulator (Or launch iOS Simulator and switch to iOS 7 device)在 iOS 7 模拟器上运行应用程序(或启动 iOS 模拟器并切换到 iOS 7 设备)
  10. If the iOS 7 Simulator is working, Hardware->Devices->Select an iOS 8 simulator.如果 iOS 7 模拟器工作正常,硬件->设备->选择一个 iOS 8 模拟器。
  11. Delete and recreate any non working iOS 8 Simulators in Window->Devices from Xcode .Xcode Window->Devices 中删除并重新创建任何不工作的 iOS 8 Simulators。

Edit: Turns out I was getting my version of the error because I had a file (the "Empty File" type) named "Frameworks" in several of my projects, and this was causing big issues with the iOS 8 simulators.编辑:结果我得到了我的错误版本,因为我的几个项目中有一个名为“Frameworks”的文件(“空文件”类型),这导致了 iOS 8 模拟器的大问题。 Renaming the file to be anything else, and then doing a Clean Build Folder fixed it right away.将文件重命名为其他任何内容,然后执行 Clean Build Folder 立即修复它。

------Deprecated Original Message Below-------- ------弃用以下原始消息------

In case this helps anyone -- I was having a similar error on Xcode 6 GM, and tried everything mentioned in these Answers, but the iOS 8 simulators would never run any of my apps (no problems with iOS 7 running from Xcode 6 though).如果这对任何人有帮助——我在 Xcode 6 GM 上遇到了类似的错误,并尝试了这些答案中提到的所有内容,但 iOS 8 模拟器永远不会运行我的任何应用程序(尽管从 Xcode 6 运行 iOS 7 没有问题) .

What did sort of work was creating a new project (new project apps would run in the iOS 8 simulators, but never any luck with existing apps).所做的工作是创建一个新项目(新项目应用程序将在 iOS 8 模拟器中运行,但与现有应用程序无关)。 Copying over files and project settings is no fun, but at least it let me do testing and see if my apps needed fixing for the iOS 8 public release.复制文件和项目设置并不有趣,但至少它让我可以进行测试,看看我的应用程序是否需要针对 iOS 8 公开版本进行修复。

Extended description of problem at https://devforums.apple.com/thread/246751 https://devforums.apple.com/thread/246751上问题的扩展描述

I tried everything mentioned above and nothing worked.我尝试了上面提到的所有内容,但没有任何效果。

Finally the only way to make it work was unsetting DYLD_INSERT_LIBRARIES =/usr/lib/libimckit.dylib最后,让它工作的唯一方法是取消设置 DYLD_INSERT_LIBRARIES =/usr/lib/libimckit.dylib

How I did this:我是如何做到的:

  1. Open terminal and typing "sudo vi /etc/launchd.conf"打开终端并输入“sudo vi /etc/launchd.conf”
  2. Changing改变

"setenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib" “setenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib”

to

"unsetenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib" “unsetenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib”

  1. Save changes保存更改
  2. Reboot your system重新启动系统

In this post [1] explain what DYLD_INSERT_LIBRARIES is for在这篇文章中 [1] 解释 DYLD_INSERT_LIBRARIES 的用途

[1] https://stackoverflow.com/a/26053165/2091181 [1] https://stackoverflow.com/a/26053165/2091181

I wrestled with this for a bit, with the simulator app reporting that it couldn't find the iOS8 simulator, and suggesting updating in Prefs/Downloads, which didn't work.我为此纠结了一会儿,模拟器应用报告说它找不到 iOS8 模拟器,并建议在 Prefs/Downloads 中进行更新,但这没有用。 I tried re-installing Beta 6 twice (without removing all the support files, which would have been next).我尝试重新安装 Beta 6 两次(没有删除所有支持文件,这本来是下一个)。 The initial installation described itself as build 6A280c;初始安装将自身描述为 build 6A280c; a fresh download yielded build 6A280e.新下载产生了内部版本 6A280e。 No luck.没运气。

Eventually, I opened Window -> Devices, and used the "+" button in the lower left to add a new simulator for iPhone 5s, iOS 8, naming it "Fresh 5s".最后,我打开Window -> Devices,并使用左下角的“+”按钮为iPhone 5s、iOS 8添加一个新的模拟器,命名为“Fresh 5s”。 The Schemes popup now displayed three iPhone 5S/iOS 8 options (none with the name I designated, but differentiated by UUIDs); Schemes 弹出窗口现在显示了三个iPhone 5S/iOS 8 选项(没有我指定的名称,但通过 UUID 区分); at least one of them worked.其中至少有一个工作。

I'm guessing that this feature (collections of arbitrary simulator instances) will be very useful when it's baked.我猜这个功能(任意模拟器实例的集合)在烘焙时会非常有用。 In the meantime, I guess I'll need to manage the list of simulators manually.与此同时,我想我需要手动管理模拟器列表。

Do following steps worked for me:执行以下步骤对我有用:

1. Launch the iOS Simulator and go to iOS Simulator --> Reset Content and Settings...

2. Close all the applications and restart your mac 

3. Open Xcode6.0.1 or 6.0 and test the iOS Simulator

Had the same problem after moving from Xcode 6 beta 5 to beta 6, but also for the iOS 7.1 simulator.从 Xcode 6 beta 5 迁移到 beta 6 后遇到了同样的问题,但对于 iOS 7.1 模拟器也是如此。 Restarting my machine seemed to do the job.重新启动我的机器似乎可以完成这项工作。 I did not need to update from Xcode 5.1.1 CLT to Xcode 6.0 CLT.我不需要从 Xcode 5.1.1 CLT 更新到 Xcode 6.0 CLT。

I tried all of the solutions above, and was still unable to launch the iOS8 Simulator.我尝试了上述所有解决方案,但仍然无法启动 iOS8 模拟器。 The iOS7 Simulators all launched fine. iOS7 模拟器都运行良好。

Looking at the Console, I found that the launch was crashing, and the crash log complained about the dynamic library, libimckit.dylib.查看Console,发现launch是crash,并且crash log抱怨动态库libimckit.dylib。 You can read about that here: https://discussions.apple.com/thread/5781366?start=0&tstart=0你可以在这里阅读: https : //discussions.apple.com/thread/5781366?start=0&tstart=0

The quick solution, remove that and its partner library, reboot, and it loads.快速解决方案,删除它及其合作伙伴库,重新启动,然后加载。

Is there anything interesting in ~/Library/Logs/CoreSimulator/CoreSimulator.log? ~/Library/Logs/CoreSimulator/CoreSimulator.log 中有什么有趣的东西吗?

The "Unable to boot the iOS Simulator." “无法启动 iOS 模拟器”。 error message is almost always because launchd_crashed because DYLD_INSERT_LIBRARIES was set to something not compatible with the iOS Simulator runtime.错误消息几乎总是因为 launchd_crashed 因为 DYLD_INSERT_LIBRARIES 设置为与 iOS 模拟器运行时不兼容的内容。 Do you have any crash logs (eg: launchd_sim crashes) in ~/Library/Logs/DiagnosticReports?在 ~/Library/Logs/DiagnosticReports 中是否有任何崩溃日志(例如:launchd_sim 崩溃)? If so, check if they show DYLD_INSERT_LIBRARIES being set.如果是这样,请检查它们是否显示 DYLD_INSERT_LIBRARIES 正在设置。 If that's the case, your options are to either update to an OS X Yosemite host (which will deal with this issue) or unset DYLD_INSERT_LIBRARIES (likely set in /etc/launchd.conf or ~/.launchd.conf)如果是这种情况,您的选择是更新到 OS X Yosemite 主机(将处理此问题)或取消设置 DYLD_INSERT_LIBRARIES(可能在 /etc/launchd.conf 或 ~/.launchd.conf 中设置)

  1. Force Quit All the apps including xcode and simulator强制退出所有应用程序,包括 xcode 和模拟器
  2. Restart MAC重启MAC

Checking in the "Locations" Xcode preference, I had two items of the same version , one located in the app translocation area (/var/.../AppTranslocation/...).检查“位置”Xcode首选项,我有两个相同版本的项目,一个位于应用程序易位区域(/var/.../AppTranslocation/...)。 Also I had previously done a manual command line tools install.我之前也做过手动命令行工具安装。 To resolve this in the end I had to delete /Applications/Xcode.app and remove the manual command line tools install:为了最终解决这个问题,我不得不删除 /Applications/Xcode.app 并删除手动命令行工具安装:

sudo rm -rf /Library/Developer/CommandLineTools

Then installed Xcode anew, and rebooted.然后重新安装Xcode,并重新启动。 Boom!繁荣! Simulator working again.模拟器再次运行。

Reboot your mac os.重新启动你的 mac os。 its working correctly on xcode 11.3.x and mac os 10.14.6.它在 xcode 11.3.x 和 mac os 10.14.6 上正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM