问题
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:
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.
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.
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.1 to Xcode 8:
/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?
回答1:
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.
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.
↳ 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.
回答2:
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.
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:
- 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
来源:https://stackoverflow.com/questions/37956778/xcode-8-compile-with-ios-9-3-base-sdk