简体   繁体   English

XCode 7.3.1中的Swift代码在iOS 10中不起作用

[英]Swift Code in XCode 7.3.1 not working in iOS 10

I am building an iOS app using Swift 2.2, XCode 7.3.1, which is going to go live very soon. 我正在使用Swift 2.2,XCode 7.3.1构建iOS应用程序,该应用程序将很快上线。 I upgraded my iPhone to iOS 10.0 and now when I try to run my code in my iPhone, I am getting the error - 我将iPhone升级到iOS 10.0,现在当我尝试在iPhone中运行代码时,出现错误-

在此处输入图片说明

At this stage of my project I don't want to upgrade to XCode 8.0 and use Swift 3.0. 在我项目的现阶段,我不想升级到XCode 8.0并使用Swift 3.0。 Is there any way I can make my code written in XCode 7.3.1 work in iOS 10. My code is working well for iPhones having iOS versions 9.3.2 有什么办法可以使用XCode 7.3.1编写的代码在iOS 10中工作。我的代码对于具有iOS版本9.3.2的iPhone正常运行。

Thanks 谢谢

No, Xcode 7.3.1 does not support iOS 10. You cannot. 否,Xcode 7.3.1不支持iOS10。您不能。 You will have to upgrade to Xcode 8. 您将必须升级到Xcode 8。

And, you should upgrade because it also provides you Swift 2.3 which will help you run latest SDK for iOS 10 etc and the transformation is automatic. 并且,您应该进行升级,因为它还为您提供了Swift 2.3,它将帮助您运行适用于iOS 10等的最新SDK,并且转换是自动的。

Read here: https://developer.apple.com/swift/blog/ 在这里阅读: https : //developer.apple.com/swift/blog/

To detect device in XCode you must install software with appropriate version or system will show you the message you have mentioned in the question. 要在XCode中检测设备,您必须安装具有适当版本的软件,否则系统将向您显示问题中提到的消息。

A workaround as per your wish is that every time you make an IPA of your release and install it in the device you want to run with it (that could be a hard time if you deploy several times a day). 根据您的意愿,一种变通方法是,每次制作发行版的IPA并将其安装在要与其一起运行的设备中(如果一天部署几次,则可能会很困难)。 Remember there is an upward compatibility but no downward compatibility that is if your deployment target is 8 or above you can run the IPA on device having iOS 8 or above but not in iOS 7. 请记住,存在向上兼容性,但没有向下兼容性,如果您的部署目标是8或更高,则可以在具有iOS 8或更高版本的设备上运行IPA,但不能在iOS 7中运行IPA。

Perhaps you may get some issues on running it on new iOS because of the some obsolete or new features, and to fix that you must upgrade XCode and compile your code on it. 也许由于某些过时或新功能而在新iOS上运行它时可能会遇到一些问题,并且要解决此问题,您必须升级XCode并在其上编译代码。

Hope that helps! 希望有帮助!

Copy the folder 10.0 (14A345) in DeviceSupport folder of Xcode8 to Xcode8的DeviceSupport文件夹中的文件夹10.0(14A345)复制到

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

It works for me :) 这个对我有用 :)

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

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