Xcode 5有一个首选项窗格,允许一个人下载iPhone 6.1模拟器,但我找不到一个地方,它允许下载iOS 6 SDK,因此不可能将活动SDK设置为iOS 6时,用Xcode 5开发。是否存在允许Xcode 5安装iOS 6 SDK的解决方案?

编辑:

既然Xcode 5已经普遍可用,并且允许你下载以前版本的SDK,那么变通方法应该不再是必要的了。


当前回答

Download Xcode 4.6.x from the Apple Dev Center: https://developer.apple.com/downloads/index.action Create a folder called Xcode4 within the Applications folder and drag-n-drop the downloaded dmg there. Open a terminal window $sudo cp -R /Applications/Xcode4/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ You will be prompt to enter a password since you're inside a system folder Open Xcode 5 and you should now see both SDKs

其他回答

将6.1 SDK链接到Xcode 5是第一步。然而,这仍然不能解决在iOS 7上运行的新UI元素,视图控制器是全尺寸的等问题。

正如在这个回答中所描述的,在iOS 7上还需要将UI切换到遗留模式:

[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"UIUseLegacyUI"];
[[NSUserDefaults standardUserDefaults] synchronize];

注意:这是一个未记录的键,不建议应用程序商店构建!

此外,根据我在设备上测试的经验,我发现它只能在我第二次启动应用时运行,即使我在应用启动的早期运行了代码,在+[AppDelegate initialize]中。此外,它与使用Xcode 4.6构建的版本也有细微的区别。例如,透明导航条的行为不同(导致视图是全尺寸的)。

然而,由于Xcode 4.6.3在Mavericks上崩溃(至少对我来说,见rdar://15318883),这至少是一个继续使用Xcode 5进行调试的解决方案。

Download Xcode 4.6.x from the Apple Dev Center: https://developer.apple.com/downloads/index.action Create a folder called Xcode4 within the Applications folder and drag-n-drop the downloaded dmg there. Open a terminal window $sudo cp -R /Applications/Xcode4/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ You will be prompt to enter a password since you're inside a system folder Open Xcode 5 and you should now see both SDKs

您可以下载旧的SDK并将其安装进去

xcode /内容/开发/平台/ iPhoneOS.platform /开发/ sdk /

文件夹中。注销+登录只是为了确保更改生效,你应该在你的新XCode中看到旧的SDK

对我来说最简单的解决方法:

Locate an older SDK like for example "iPhoneOS6.1 sdk" in an older version of xcode for example. If you haven't, you can downlad it from Apple Developer server at this address: https://developer.apple.com/downloads/index.action?name=Xcode When you open the xcode.dmg you can find it by opening the Xcode.app (right click and "show contents") and go to Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1 sdk Simple Copy the folder iPhoneOS6.X sdk and paste it in your xcode.app right click on your xcode.app in Applications folder. Go to Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ Just paste here.

关闭你的xcode应用程序,重新打开它。

要在模拟器上测试iOS 6中的应用程序: -在你的活动场景中选择iOS 6.0即可。

要在iOS 6中构建应用程序,那么你的应用程序的设计将是iOS 7 iPhone上的旧设计: —在“Targets - Base SDK”中选择“iOS6.1”

请注意:当你在你的目标中改变基础SDK时,iOS 7.0将不再可用来构建模拟器!

找到并下载旧的SDK。在这里可以找到旧的sdk。

我已经复制了xcode。app目录为Xcode_4.6.3.app。

现在你可以在两个xcode版本中进行测试和调试。你必须从相应的文件夹中运行它们,或者在桌面上创建快捷方式。从命令行构建时,将参数设置为iPhoneOS6.1而不是iPhoneOS7.0

这在Xcode5和iOS中非常有效。

进入Xcode5的SDK目录。它通常位于:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs

向旧SDK添加一个符号链接,如下所示:

sudo ln -s /Applications/Xcode_4.6.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk iPhoneOS6.1.sdk

或者更准确地说,在命令行中,

sudo ln -s /Applications/Xcode_4.6.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk