xctool build with today extension
Asked Answered
A

1

6

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.

Atalanta answered 12/12, 2014 at 14:21 Comment(0)
P
3

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.

Potion answered 24/12, 2014 at 13:47 Comment(5)
"Then set the right provisioning profiles for your targets" how to do it via xcodebuild command line?Masry
You don't do this with xcodebuild command, instead you need to set them in Xcode's Build Settings in the configuration that you created in step 1 (see pic 3). You only need to specify the configuration to xcodebuild and don't care what provisioning profile it is.Potion
may be you right. I've just put it as you said. Not found other ways. Thanks.Masry
-exportWithOriginalSigningIdentity will also preserve the original provisioning profile? I doubt. -exportProvisioningProfile is required for xcodebuild -exportArchive -exportFormat ipa IMHONickel
as of Xcode 9, I get an error when trying to include -exportWithOriginalSigningIdentity. "xcodebuild: error: invalid option '-exportWithOriginalSigningIdentity'"Democritus

© 2022 - 2024 — McMap. All rights reserved.