I\'m trying to build my app with xcodebuild:
xcodebuild -workspace \"RG.xcworkspace\" -scheme \"Production\" -configuration \"Release\" build CONFIGURATION_B
I spent far too long working on this today. I was on my way to bed when the answer hit me:
In each of your targets's Build Settings you should set a $VARIABLE
for the profile name. To do this, selected "Other" from the bottom of the list of profiles. Doing this will open a text field - choose a different $VARIABLE
for each target - for example I chose $APP_PROFILE
for the container app target and $EXTENSION_PROFILE
for my Today extension target
This will result in something like the following:
Finally, when building with xcodebuild
, specify the profile UUIDs as you did with PROVISIONING_PROFILE
:
xcodebuild ... APP_PROFILE="85b6f019-d5e5-43a7-9e8f-e3aaed64a7e4" EXTENSION_PROFILE="e50cf605-ab63-40ad-8329-2758359ea748"
Building from within XCode seems to be unaffected - as far as I could tell XCode is selecting the default profiles (as if in "Automatic" mode)
Theoretically this would support multiple extensions too.
Works for me with XCode 6.3 :)
There is an option, -exportSigningIdentity
which can help you, because provisioning profiles of Application & Extension/Widget may be different, but signing identities of app & extension are supposed to be same.
For example, you will see that,
are essentially same string, lets say this identity is "Code Signing Identity (id)". So to build & export archive, what you can run, are simply,
xcodebuild clean -workspace HelloWorld.xcworkspace -scheme HelloWorld
xcodebuild -workspace HelloWorld.xcworkspace -scheme HelloWorld archive -archivePath ~/output/HelloWorld.xcarchive
xcodebuild -exportArchive -exportFormat ipa -archivePath ~/output/HelloWorld.xcarchive -exportPath "HelloWorld.ipa" -exportSigningIdentity "Code Signing Identity (id)"
Reference: xcodebuild documentation
Months later... Found a solution that doesn't involve settings values within Xcode: Within sigh there is a script that is capable of resigning an ipa file with given profiles. The following works for me:
bash resign.sh Experiments-AdHocProd.ipa "iPhone Distribution: Company Pty Ltd" output.ipa -p com.company.experiments.AudioPlugin=Experiments-AdHocProd_com.company.experiments.AudioPlugin.mobileprovision -p com.company.experiments=Experiments-AdHocProd.mobileprovision --verbose
where:
Experiments-AdHocProd.ipa
is the existing ipacom.company.experiments.AudioPlugin
is the extension bundle IDExperiments-AdHocProd_com.company.experiments.AudioPlugin.mobileprovision
is the extension profilecom.company.experiments
is the main app bundle identifierExperiments-AdHocProd.mobileprovision
is the main app profileEach profile's bundle identifier must match that of the app it will be signed with.
Something I found that is important to note is that if a bundle identifier has a wildcard (in my case Experiments-AdHocProd.mobileprovision
does) then the profiles with explicit IDs must be passed into -p
first.
Alternatively, you could use sigh
to perform the resign. Unfortunately, sigh --help
doesn't say anything about resigning binaries with extensions, however sigh resign --help
does.
In Swift, Pod files framework will be packaged separately. Following steps solved the problem.
1. Select pods
2. Targets
3. General
4. Edit bundle id
5. Build Settings
6. Code Signing
7. Provisioning profile -> select the valid profile
8. Code Signing Identity -> Select the respective identity from
profile.
Repeat the same for all targets.
I am able to generate build.