【整理】Swift代码能在旧版本的iPhone上运行吗

【背景】

需要去搞清楚,Swift代码能否在旧版本的iPhone上运行。

【折腾过程】

1.搜:

Swift代码能在旧版本的iPhone上运行吗

参考:

新手不太懂,编译swift不是要iOS SDK 8.0才可以吗?那编出来的App能在iOS6及以下运行吗?

对苹果“五仁”编程语言Swift的简单分析 – Proteas的专栏 – 博客频道 – CSDN.NET

2.搜:

Swift run on old ios device

参考:

Will Swift Apps Work on Older iPhones? | One Month

Apple’s release of Swift 1.0, has sparked the question:

"Will older iPhones be able to run Swift apps?"

The short answer is yes. But there’s a bit more to it than that.

Will Old Hardware Support Swift?

Yes, as long as you have one of the following you’re good:

  • iPhone 6, iPhone 6 Plus
  • iPhone 5S, iPhone 5C, iPhone 5
  • iPhone 4S, iPhone 4
  • 4th Generation iPad, 3rd Generation iPad, iPad 2
  • 5th generation iPod touch

Will Old Software Support Swift?

Yes, Swift will support the following operating systems…

iPhone/iPad:

  • iOS 7 (current)
  • iOS 8 (upcoming)

Mac:

  • OS X Mavericks (current)
  • OS X Yosemite (upcoming)

What % of People Will Have Trouble?

I’ve got good news… statistically, most people have already upgraded to at least iOS7!

Here’s the raw stats:

  • 92% of iOS devices are running iOS 7 right now.
  • OS X Mavericks is expected to be running on over 70% of Macs

In Conclusion

Apple put quite a lot of effort to make sure Swift would be fully compatible with the majority of devices. This is a great sign and a big win for Swift.

osx – Do Swift-based applications work on OS X 10.9/iOS 7 and lower? – Stack Overflow

iOS 7 and OS X 10.9 minimum deployment target

    The Swift compiler and Xcode now enforce a minimum deployment target of iOS 7 or OS X Mavericks. Setting an earlier deployment target results in a build failure.

http://adcdownload.apple.com//Developer_Tools/xcode_6_beta_4_o2p8fz/xcode_6_beta_4_release_notes.pdf

So my previous answer(Shown below) will not be applicable to any further development. Swift will no longer available for iOS6 and below ”

 

【总结】

简答:

可以的。

因为是会,针对旧的iOS设备,会在生成可执行文件时打包相应的库函数的。是编译为二进制的。

所以理论上旧的设备都是可以运行的。

 

详解:

基于目前绝大多数(92%)的iOS设备都已经升级到iOS7了,而Swift支持iOS7和iOS8,所以可以说成是:

目前针对于绝大部分的iOS设备,都可以正常的运行Swift,没有任何问题。

另:

桌面版的OS X:目前多数Mac设备都是OS X Mavericks或更新设备了,而Swift支持OS X Mavericks和OS X Yosemite,所以也是:

目前多数的Mac桌面端设备都支持Swift。



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量