I\'ve got an iOS app which I\'ve recently switched to Xcode 8. As part of that we switched from swift 2.2 to 2.3 (swift 3 will come later).
I\'ve got an automated build
I could never get command line xcodebuild to ever work with automatic code signing. I assume because the automated build machine runs as a different account which is only accessed via SSH - It's never had "full" Xcode run as that user account and it doesn't have any certificates in it's Login keychain or anything like that.
I didn't want to use something like shenzhen
because I've had nothing but bad experiences from those kinds of things in the past. The Xcode build system is complicated and fragile enough without having to add in more scripts and things that could go wrong or out of date.
Here's what I ended up doing to fix the problem (it's horrible, but it was the only thing I could find that made it work in the end)
In the automated build script, edit the .pbxproj
to search and replace Provisioning Style = Automatic;
with Provisioning Style = Manual;
. Also replace iOS Developer
with iOS Distribution
for the code signing stuff in the same pbxproj file. These two things turn off automatic signing
Run xcodebuild
to build (but not archive) the project in the same way I did in Xcode7 . Xcode compiles the app and signs it, but it's not valid yet, as it contains libswiftRemoteMirror.dylib
and also for some reason hasn't got any entitlements file
Delete libswiftRemoteMirror.dylib
from the app bundle (this invalidates the signature)
Generate an Entitlements.plist
in the app bundle folder by extracting the entitlements bit from the provisioning profile (Like what BlackBerry's SWSiOSResign.sh script does)
Re-sign the app bundle using codesign --entitlements
From there, use a similar technique to what bq/package_ipa.sh does and copy the SwiftSupport folder, then zip the file into an ipa
.
I couldn't actually use package_ipa.sh
file, I needed to re-implement similar logic instead because I need to reference Swift_2.3.toolchain
to get the SwiftSupport from as my app is still swift 2.3 - not XcodeDefault.toolchain
(which is swift 3)
It seems like I should be able to use xcodebuild --archive
in combination with some other things to avoid some of these steps. I could never get that to work under Xcode7, but I might try again with XC8 if I have time