简体   繁体   English

新的Xcode 6项目 - 如何在iOS 7模拟器中运行

[英]New Xcode 6 Project - How to run in the iOS 7 Simulator

I try to create a new project with Xcode 6 that also runs on iOS 7. I've created a new project and then did the following: 我尝试使用Xcode 6创建一个也在iOS 7上运行的新项目。我创建了一个新项目,然后执行以下操作:

  1. Set Project's iOS Deployment Target to 7.0 将Project的iOS部署目标设置为7.0
  2. Referenced a Launch Image Source in the Assets 在资产中引用了启动图像源

Still, when trying to run on an iOS 7 simulator, the following error is shown: 仍然,当尝试在iOS 7模拟器上运行时,会显示以下错误:

"iPhone 5s not available. Please select a different device and try again." “iPhone 5s不可用。请选择其他设备,然后重试。”

(My older projects run fine on iOS 7 simulators.) (我的旧项目在iOS 7模拟器上运行良好。)

How I can make a new project run in the iOS 7 simulator? 如何在iOS 7模拟器中运行新项目?

EDIT 编辑

The output of xcrun simctl list is the following: xcrun simctl list的输出如下:

== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)
Resizable iPhone (com.apple.CoreSimulator.SimDeviceType.Resizable-iPhone)
Resizable iPad (com.apple.CoreSimulator.SimDeviceType.Resizable-iPad)
== Runtimes ==
iOS 7.0 (7.0 - Unknown) (com.apple.CoreSimulator.SimRuntime.iOS-7-0) (unavailable, runtime path not found)
iOS 7.1 (7.1 - Unknown) (com.apple.CoreSimulator.SimRuntime.iOS-7-1) (unavailable, runtime path not found)
iOS 8.0 (8.0 - 12A365) (com.apple.CoreSimulator.SimRuntime.iOS-8-0)
== Devices ==
-- iOS 7.0 --
    iPhone 4s (9A55186B-9B91-4526-A2AB-EF0C49F592A4) (Shutdown) (unavailable)
    iPhone 5 (D326EE14-21DA-4FA5-A229-F0BACDA6C9F3) (Shutdown) (unavailable)
    iPhone 5s (1AC03181-38D5-4C24-9928-4EFDE83D0ACD) (Shutdown) (unavailable)
    iPad 2 (212A00A7-1D1F-4392-8AE6-24C46EA9A507) (Shutdown) (unavailable)
    iPad Retina (9471D6C8-DDE7-4D08-B015-89CA02ED4C46) (Shutdown) (unavailable)
    iPad Air (E84ADD9C-7BA4-4EBF-B98E-DB6EAF99EFA6) (Shutdown) (unavailable)
-- iOS 7.1 --
    iPhone 4s (836A9B30-D104-4D54-98A2-479F7F35F4EC) (Shutdown) (unavailable)
    iPhone 5 (39EB7E74-4665-492B-9097-F454D083CFD8) (Shutdown) (unavailable)
    iPhone 5s (DAE6E1F3-E4F1-4D4F-9C16-73B495A08415) (Shutdown) (unavailable)
    iPad 2 (D34D496D-39CA-4D2E-9C6A-C5EB7B62C8DC) (Shutdown) (unavailable)
    iPad Retina (8EFF2BF2-F639-46C2-AB21-8B28858DF778) (Shutdown) (unavailable)
    iPad Air (434AB478-DD08-481D-A75D-3EA94A440814) (Shutdown) (unavailable)
-- iOS 8.0 --
    iPhone 4s (EEAA9E7C-867E-4E71-99CE-A5C729FB2F21) (Shutdown)
    iPhone 5 (DA90266D-1FF5-4E84-B806-DBE49F1A86DB) (Shutdown)
    iPhone 5s (B673A5D8-7992-41AE-9B43-200C064ECFDA) (Shutdown)
    iPhone 6 Plus (19F9C682-B4D8-488B-82C4-8B5BAD8D38FB) (Shutdown)
    iPhone 6 (2FCC7DD6-2274-4B7F-A151-1A49AB31AE65) (Booted)
    iPad 2 (801852DD-7EFA-4336-9686-42C5D65DAABD) (Shutdown)
    iPad Retina (314D3C76-6D20-466B-AD61-567CE202556F) (Shutdown)
    iPad Air (5B47FA82-F1F6-43C2-A373-BABBEFA0AB22) (Shutdown)
    Resizable iPhone (8F4B8FAF-AEB9-4782-AC09-6F8B4BDD37AA) (Shutdown)
    Resizable iPad (DEBDB255-8650-4B8D-B161-D9FA26331ACD) (Shutdown)

I meet this problem too. 我也遇到了这个问题。

  1. Preferences -> Downloads -> Components Preferences - > Downloads - > Components
  2. Then click the download button. 然后单击下载按钮。

    • If you've downloaded them before, Xcode will install them directly. 如果你以前下载过它们,Xcode会直接安装它们。

Maybe you've just update your Xcode. 也许你只是更新你的Xcode。 Xcode 6 is not installed 7.x simulators as default. 默认情况下,Xcode 6未安装7.x模拟器。 However, you installed them on previous version Xcode. 但是,您在以前的Xcode版本上安装了它们。

In the Devices window, delete all devices one by one. 在“设备”窗口中,逐个删除所有设备。 Now add them back one by one. 现在逐个添加它们。 Now restart the computer (not just Xcode). 现在重新启动计算机(而不仅仅是Xcode)。 This will leave you with only good devices and you'll know whether you need to download the older simulators. 这将使您只有好的设备,并且您将知道是否需要下载旧的模拟器。

I resolve this issue by performing the following steps: 我通过执行以下步骤解决了此问题:

1) From my Xcode 6.1 --> Opens available simulators/devices Devices List. 1)从我的Xcode 6.1 - >打开可用的模拟器/设备设备列表。

2) Then Click on the bottom of the list more simulator button --> Download simulator windows opens. 2)然后单击列表底部的更多模拟器按钮 - >下载模拟器窗口打开。

3) Download your desire simulator 7.0 or 7.1 or both. 3)下载您的欲望模拟器7.0或7.1或两者。

If simulators downloaded before,then Xcode will install them automatically. 如果以前下载过模拟器,那么Xcode会自动安装它们。

Check the Screen Shots: 检查屏幕截图:

在此输入图像描述在此输入图像描述

Hope this will help you out cheers. 希望这会帮助你欢呼。

Based on the output of simctl list, you should see the 8.0 simulators in Xcode but not the 7.x simulators. 根据simctl列表的输出,您应该在Xcode中看到8.0模拟器,而不是7.x模拟器。 The 7.x simulators will appear once you download and install the 7.x simulator runtimes. 一旦下载并安装7.x模拟器运行时,就会出现7.x模拟器。

I face the same problem. 我面临同样的问题。 And I have fixed it. 我已经修好了。 When you update to Xcode 6.0+, the Xcode will break the runtime of iOS 7 simulators. 当您更新到Xcode 6.0+时,Xcode将破坏iOS 7模拟器的运行时。 Though you have the Devices of iOS 7.1 but without runtime, the simulators are not available. 虽然您拥有iOS 7.1设备但没有运行时,但模拟器不可用。 You must download the 7.1 runtime again. 您必须再次下载7.1运行时。

But we all know download the simulators in Xcode is very painful. 但我们都知道在Xcode中下载模拟器非常痛苦。 An easier way is to copy the "iOS 7.1 SDKs" form other's Mac (in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs). 一种更简单的方法是从其他Mac上复制“iOS 7.1 SDK”(在/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs中)。

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

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