I was able to export ipa files through xcodebuild. Since xctool is built on xcodebuild, this answer may help.
First of all, when you create an extension, the purpose of the extension will be built into your main application scheme.
Thus, there is no need to use two schemes.
Then, on the project settings page, create a new configuration, say AdHoc
. And then you can install the new Provisioning Profile
in both settings of your target assembly.
(project settings)
(build settings for one target)
Then set the correct provisioning profiles for your purposes (and you better set code sign identity
to automatic so that Xcode can determine which code sign identifier should be used).
In the next step, you can archive your application using xcodebuild with the new configuration that you just created:
xcodebuild -project Extension\ Demo.xcodeproj -scheme Extension\ Demo -sdk iphoneos -archivePath ./Build/extension-demo.xcarchive -configuration AdHoc archive
At this point, the code will sign two of your goals separately for the specified security profiles.
Finally, export the .xcarchive
file to ipa
using xcodebuild again;
xcodebuild -exportArchive -archivePath ./Build/extension-demo.xcarchive -exportPath ./Build/extension-demo.ipa -exportWithOriginalSigningIdentity
Note that -exportWithOriginalSigningIdentity
set, so xcodebuild will not re-sign your ipa, and the code signature is saved in the xcarchive file.