I am attempting to run an enterprise signed build of my Swift app on a real phone running iOS 7.1.
If I create the enterprise signed app via the Xcode interface, the
It looks like as of Xcode 6 Beta 6 you need to codesign the Swift libraries manually.
codesign --force --verbose --sign 'iPhone Distribution: My Company' Foo.app/
codesign --force --verbose --sign 'iPhone Distribution: My Company' Foo.app/Frameworks/*
I have filed a bug report with Apple and hopefully they will make this happen automatically if you use codesign's --deep
option.
codesign -f -s 'iPhone Distribution: My Company' Foo.app/Frameworks/*
codesign -f -s 'iPhone Distribution: My Company' Foo.app --entitlements=$ENTITLEMENTS_PATH
not the other way around, otherwise it will fail on installing
The solution is not obvious but easy. Apple changed something in the code signing process for Swift:
The error should be gone.
When building my Mac app from command line, I can see Xcode code-signing Swift libraries by running swift-stdlib-tool:
/Applications/Xcode6-Beta5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool --verbose --copy
Copying libswiftCore.dylib from /.../XcodeDefault.xctoolchain/usr/lib/swift/macosx to /.../LiveReload.app/Contents/Frameworks
... (repeat for 8 libswift*.dylib libraries)
/usr/bin/codesign '--force' '--sign' 'C2F5439B97B16E0BD7FF671913391346B17440DC' '--verbose' '/.../LiveReload.app/Contents/Frameworks/libswiftCore.dylib'
... (repeat for 8 libswift*.dylib libraries)
Looks like you can run similar codesign commands yourself.
Also, this is for Mac, but perhaps if you run xcodebuild for your iOS project, you will see the specific commands that are invoked for your project. (Just configure the binary to be signed in Release configuration, the way you'd like it signed in your IPA, including the provisioning profile.)
I create a gist to solve this problem, and it works (->link).
The main idea is to codesign the dylibs frist, and then codesign the app.