How to exit the application with the application store preparation profile to add a beta report-active key?

To distribute applications through the new Test Flight test service, the beta-reports-active key is required. I am currently using the Apple bot server to distribute to my old Flight Flight system with an Ad Hoc distribution profile. Using the post build trigger, I want to create the created archive and create the App Store ipa distribution, which I can upload to iTunes Connect. I wrote a script that does this. I use the xcrun command to build:

/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${APP}" -o "${APP_STORE_IPA}" --sign "${SIGNING_IDENTITY}" --embed "${PROVISIONING_PROFILE}"

SIGNING_IDENTITY and PROVISIONING_PROFILE are app store distribution certificates / profiles. Thus, the provisioning profile is embedded in ipa and contains the beta-reports-active flag. However, when I look at ipa to check its rights, it is not there.

What am I doing wrong? All the information I saw on this just suggested restoring the training profile. I did this and know that the key is present. It is not added to the rights. I have a widget that also comes in ipa. I do not refuse it.

+7
ios xcode continuous-integration provisioning-profile ios-app-extension
source share
5 answers

Ok, so I think I finally figured it out. It seems that the Bot server may have several kinks that Apple should smooth out. I noticed that the distribution IPA created by the Bot server does not have any necessary rights to my application. I searched a bit and found that other people have the same problem. Here is a question that explains the problem very well: IPA created using the Xcode bot does not start for APNS, but it starts if it is created manually through Xcode itself or is created as an archive using Xcode

So, with that in mind, I created and added a file of rights to my project with the minimum rights that I need. I also did the same for the widget that is in my project. Then, during my trigger after integration, I read both rights files and added the necessary rights to it.

 # Copy the Entitlements file out of the payload so we can update it APP_ENTITLEMENTS="/tmp/distributionEntitlements.plist" rm -rf ${APP_ENTITLEMENTS} codesign -d --entitlements :${APP_ENTITLEMENTS} "/tmp/Payload/MyAppName.app" WIDGET_ENTITLEMENTS="/tmp/widgetDistributionEntitlements.plist" rm -rf ${WIDGET_ENTITLEMENTS} codesign -d --entitlements :${WIDGET_ENTITLEMENTS} "/tmp/Payload/MyAppName.app/Plugins/${WIDGET_NAME}" # Copy over the latest build the bot just created echo "Copying latest Archive to /tmp/..."; cp -Rp "${XCS_ARCHIVE}" "/tmp/" APP="/tmp/Archive.xcarchive/Products/Applications/MyAppName.app" echo "Updating entitlements file" /usr/libexec/PlistBuddy -c "Add :beta-reports-active bool true" ${APP_ENTITLEMENTS} /usr/libexec/PlistBuddy -c "Add :aps-environment string production" ${APP_ENTITLEMENTS} cat ${APP_ENTITLEMENTS} echo "Updating widget entitlements file" /usr/libexec/PlistBuddy -c "Add :beta-reports-active bool true" ${WIDGET_ENTITLEMENTS} cat ${WIDGET_ENTITLEMENTS} 

Then, of course, you have to assign these applications again:

 echo "Codesign the widget" cp "${WIDGET_PROVISIONING_PROFILE}" "${APP}/Plugins/${WIDGET_NAME}/embedded.mobileprovision" codesign -fv -s "${FULL_SIGNING_IDENTITY}" "${APP}/Plugins/${WIDGET_NAME}" --entitlements "${WIDGET_ENTITLEMENTS}" --preserve-metadata=resource-rules,requirements echo "Codesign the app" codesign -fv -s "${FULL_SIGNING_IDENTITY}" "${APP}" --entitlements "${APP_ENTITLEMENTS}" --preserve-metadata=resource-rules,requirements echo "Creating .ipa" # Remove any whitespace FILENAME=${XCS_BOT_NAME// /} echo "Filename: ${FILENAME}" APP_STORE_IPA="/tmp/${FILENAME}_AppStore_${VERSION_NUMBER}.ipa" rm "${APP_STORE_IPA}" /usr/bin/xcrun -sdk iphoneos PackageApplication -v "${APP}" -o "${APP_STORE_IPA}" --sign "${SIGNING_IDENTITY}" --embed "${PROVISIONING_PROFILE}" 

After all this, I can upload this IPA to Apple and distribute it using my new beta distribution TestFlight.

+2
source share

You can always try using the xcodebuild export command:

 xcodebuild -exportArchive -archivePath '{APP}' -exportPath '{IPA}' \ -exportFormat 'ipa' -exportWithOriginalSigningIdentity 

or if you need a different profile and personality:

 xcodebuild -exportArchive -archivePath '{APP}' -exportPath '{IPA}' \ -exportFormat 'ipa' -exportWithOriginalSigningIdentity \ -exportProvisioningProfile {profilename} -exportSigningIdentity {identityname} 

See man xcodebuild more details.

+4
source share

I use the following commands to cancel ipa, which might work for you. The main way is to unzip the ipa, add the desired mobile device provisioning profile, write off the code with the required certificate, and then pin it into a new ipa.

 unzip -q "${IPAFILE}" cp "${PROV_PROFILE}" Payload/*.app/embedded.mobileprovision /usr/bin/codesign -f -s "${SIGN_CERT}" --keychain "${KEYCHAIN}" \ --entitlements Payload/*.app/$APP-Entitlements.plist \ --resource-rules Payload/*.app/ResourceRules.plist Payload/*.app zip -qr "${NEW_IPAFILE}" Payload 

You can leave the --keychain option if you use the standard keychain. Your Entitlements.plist file name may be different. SIGN_CERT is the text name of your certificate. like iPhone Spread: Blah Blah

Verify that the Access Permissions panel has the same TEAM as your subscription certificate and provisioning profile.

+1
source share

Xcode automatically adds this beta right to your list of rights. You just need to make a new revision, click on the Team account under the staff, re-select your account, and the new profile will be redone when you connect iTunes.

After that, upload your new binary.

After downloading it, you can assign a beta tester to your application, select a version before release and add it to the list of internal or external beta testers.

I hope this helps.

0
source share

The best way to do this is to set the exemption grant profile to the App Store profile. Then you will not need to specify the -embed flag, and the beta report flag will be true.

enter image description here

Then, if you also need the adhoc build, you can provide the same xcrun command that was created with the adhoc provisioning profile.

 ARCHIVE = "${ARCHIVE_FOLDER}/Products/Applications/${PRODUCT_NAME}.app" #Adhoc /usr/bin/xcrun -sdk iphoneos PackageApplication -v ARCHIVE -o IPA_DESTINATION --sign "SIGNING_IDENTITY" --embed PATH_TO_PROVISIONING_PROFILE #App Store /usr/bin/xcrun -sdk iphoneos PackageApplication -v ARCHIVE -o IPA_DESTINATION --sign "SIGNING_IDENTITY" 
0
source share

All Articles