Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xctool build with today extension

we have an app integrated with today extension, we use xctool and Jenkins to do continuous build and in-house distribution.

In command line, before we use

xctool -workspace our_workspace.xcworkspace -scheme app_schme -xcconfig path_to_xcconfig -configuration Release build archive -archivePath path_to_archive

to generate archive and then export to .ipa, it works fine.

But right now with today extension, we have to build it with another scheme and xcconfig, we put certificate and provisioning profile in xcconfig, as today extension is a new target and should built with its own certificate and provisioning profile, I'm wondering how to achieve using xctool.

Any help is appreciated.

like image 399
machackx Avatar asked Dec 12 '14 14:12

machackx


1 Answers

I finally managed to export ipa files via xcodebuild. Since the xctool is built upon xcodebuild, this answer might help.

First of all, when you create an extension, the extension's target will be embedded into your main app's scheme.

enter image description here

So, there is no need to use two schemes.

Then, in your project settings page, create a new configuration, say AdHoc. And then you can set a new Provisioning Profile in both of your target's build settings.

enter image description here

(project settings)

enter image description here

(the build settings of one target)

Then set the right provisioning profiles for your targets (And you'd better set the code sign identity to automatic, so that Xcode can determine which code sign identity is to be used).

Next step, you can archive your app using xcodebuild with the new configuration you just created above:

xcodebuild -project Extension\ Demo.xcodeproj -scheme Extension\ Demo -sdk iphoneos -archivePath ./Build/extension-demo.xcarchive -configuration AdHoc archive

In this step, the codesign will sign two of your targets separately by the provisioning profiles you specified.

Finally, export the .xcarchive file to ipa, again using xcodebuild;

xcodebuild -exportArchive -archivePath ./Build/extension-demo.xcarchive -exportPath ./Build/extension-demo.ipa -exportWithOriginalSigningIdentity

Notice that -exportWithOriginalSigningIdentity is set, so that xcodebuild will not re-sign your ipa, and the code signature in the xcarchive file is preserved.

like image 146
Henry H Miao Avatar answered Nov 18 '22 13:11

Henry H Miao