【发布时间】:2016-08-05 12:08:49
【问题描述】:
我正在使用两台不同的计算机开发一个应用程序。一台是我的家用机器,它是一台较旧的 MacBook Pro,但具有最新的操作系统并运行 Xcode 7.3。我使用的第二台机器是我的工作机器,它是全新的,速度极快,但仅限于 Yosemite 和 Xcode 7.2.1。
我最近在运行 Xcode 7.2.1 的机器上遇到了构建错误,但应用程序在运行较新 Xcode 的机器上构建和运行没有错误。由于 IT 政策不可调和,我无法升级工作机器,而且我真的(真的)不希望将我的家用机器降级到 Xcode 7.2.1。
所以我想做的是写一个类似于以下伪代码的条件:
if Xcode.version == 7.3
// Run this version of the statement
refreshControl.addTarget(self, action: #selector(ReadingTVC.pullToRefreshTableView), forControlEvents: UIControlEvents.ValueChanged)
if Xcode.version == 7.2.1
// Run this different version of the statement
// I still need to figure out how to rewrite the statement for 7.2.1
这可能吗?我在 Apple 文档中找到了以下内容,但 Xcode 版本没有选项。只有 swift()、os() 或 arch():
提前致谢!
【问题讨论】:
-
希望对您有所帮助 - stackoverflow.com/questions/30790188/…