Xcode 8:使用 iOS 9.3 基础 SDK 编译?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37956778/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 8: Compile with iOS 9.3 base SDK?
提问by BradzTech
I upgraded my iOS app to Swift 3.0 in Xcode 8.0 beta (8S128d). I thought it was all ready to go and uploaded it to iTunes Connect. When I clicked "Submit for Review", it gave me a list of 26 errors, one for each embedded framework, such as:
我在 Xcode 8.0 beta (8S128d) 中将我的 iOS 应用程序升级到 Swift 3.0。我以为一切准备就绪,然后将其上传到 iTunes Connect。当我点击“提交审核”时,它给了我 26 个错误的列表,每个嵌入式框架一个,例如:
Invalid sdk value. The value provided for the sdk portion of LC_VERSION_MIN_IPHONEOS in MyApp.app/Frameworks/libswiftFoundation.dylib is 10.0 which is greater than the maximum allowed value of 9.3.2.
无效的 SDK 值。为 MyApp.app/Frameworks/libswiftFoundation.dylib 中 LC_VERSION_MIN_IPHONEOS 的 sdk 部分提供的值为 10.0,大于允许的最大值 9.3.2。
And one final error:
最后一个错误:
New apps and app updates must be built with the public (GM) versions of Xcode 6 or later, OS X, and iOS SDK. Don't submit apps built with beta software including beta OS X builds.
新应用程序和应用程序更新必须使用公共 (GM) 版本的 Xcode 6 或更高版本、OS X 和 iOS SDK 构建。请勿提交使用 Beta 版软件(包括 Beta OS X 版)构建的应用。
Okay, that would have been helpful to know before I upgraded my app! How would I go about submitting this app?
好的,在我升级我的应用程序之前知道这会很有帮助!我将如何提交此应用程序?
I noticed about changing the project Base SDK from iOS 10.0 to iOS 9.3 by copying the base SDK from Xcode 7.3.1to Xcode 8:
我注意到通过将基础 SDK 从 Xcode 7.3.1复制到 Xcode 8,将项目基础 SDK 从 iOS 10.0 更改为 iOS 9.3 :
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk
And then changing the Base SDK
setting in Xcode 8's Build Settings. However, it didn't recognize the new SDK (see this question), even when I entered it manually, and compiled it with iOS 10.0 anyway. Is there any way to compile with the older SDK?Or must I roll back my code to Swift 2?
然后更改Base SDK
Xcode 8 的 Build Settings 中的设置。但是,它无法识别新的 SDK (请参阅此问题),即使我手动输入并使用 iOS 10.0 编译它也是如此。有没有办法用旧的SDK编译?还是我必须将代码回滚到 Swift 2?
回答by l'L'l
Here's the quick solution:
这是快速解决方案:
Don't use Xcode beta versions to submit apps for release — it's beta for a reason and shouldn't be used with production code.
不要使用 Xcode 测试版来提交应用程序以供发布——它是测试版是有原因的,不应与生产代码一起使用。
Submitting Apps
提交应用程序
Apps that are created using beta versions of Xcode or that are built for beta versions of operating systems will not be accepted on the App Store and Mac App Store. Apps that you submit should be developed using the latest version of Xcode from the Mac App Store and should be built for publicly available versions of iOS, OS X, and watchOS — except when GM seeds are available. When a GM Seed of Xcode becomes available, use it to develop your app for submission. When GM seeds of iOS, OS X, or watchOS become available, build your app for these versions.
App Store 和 Mac App Store 不接受使用测试版 Xcode 创建或为测试版操作系统构建的应用程序。您提交的应用程序应使用 Mac App Store 中最新版本的 Xcode 开发,并且应为公开可用的 iOS、OS X 和 watchOS 版本构建——除非 GM 种子可用。当 Xcode 的 GM Seed 可用时,使用它来开发您的应用程序以供提交。当 iOS、OS X 或 watchOS 的 GM 种子可用时,为这些版本构建您的应用程序。
? https://developer.apple.com/support/pre-release-software/
? https://developer.apple.com/support/pre-release-software/
Re: Okay, that would have been helpful to know before I upgraded my app! How would I go about submitting this app?
回复:好的,在我升级我的应用程序之前知道这会很有帮助!我将如何提交此应用程序?
Use the current or GM release of Xcode to build and submit your app.
使用 Xcode 的当前版本或 GM 版本来构建和提交您的应用程序。
回答by BradzTech
Unfortunately, it doesn't look like there's a way to change the SDK version in Xcode Beta; it could be either a bug or just the fact that Apple wants you using the beta SDK alongside the beta software. Like @l'L'l said, one must open the app in stable Xcode in order for the App Store to accept the submission.
不幸的是,在 Xcode Beta 中似乎没有办法更改 SDK 版本;这可能是一个错误,也可能只是因为 Apple 希望您将 Beta SDK 与 Beta 软件一起使用。就像@l'L'l 所说的那样,必须在稳定的 Xcode 中打开应用程序才能让 App Store 接受提交。
However, I did find that downgrading the project to Swift 2 wasn't exorbitantly difficult. It only took me an hour to "downgrade" the entire project by manually fixing all of the errors in Xcode 7.3. In case it will help anyone, the main patterns I noticed during the process were:
但是,我确实发现将项目降级到 Swift 2 并不是非常困难。通过手动修复 Xcode 7.3 中的所有错误,我只花了一个小时就“降级”了整个项目。如果它对任何人都有帮助,我在此过程中注意到的主要模式是:
- Changing function declarations to not have an _ before the first argument, because the first argument is not anonymous in Swift 3
- Removing the first argument label from all function calls, which sometimes involves renaming the function (including in delegates, which sometimes don't report an error)
- Changing a couple built-in properties, like
label.isOn
tolabel.on
- Adding
NS
before several object names, like NSData and NSTimer, which became Data and Timer in Swift 3, respectively - "Downgrading" the Storyboard by re-saving it
- Compile using Xcode-stable but upload with Xcode-beta; Xcode-stable had issues with my provisioning profiles, but it turns out it doesn't matter which version you use the upload the binary from Organizer
- 将函数声明更改为在第一个参数之前没有 _,因为第一个参数在 Swift 3 中不是匿名的
- 从所有函数调用中删除第一个参数标签,这有时涉及重命名函数(包括在委托中,有时不报告错误)
- 更改内置属性一对夫妻,喜欢
label.isOn
给label.on
NS
在几个对象名之前添加,比如NSData和NSTimer,在Swift 3中分别变成了Data和Timer- 通过重新保存来“降级”故事板
- 使用 Xcode-stable 编译但使用 Xcode-beta 上传;Xcode-stable 对我的配置文件有问题,但事实证明,您使用哪个版本从 Organizer 上传二进制文件并不重要