On our jenkins, we use the xcrun to package the application and pass the provisioning profile with embed option.
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"
Now, we have an extension that's included with the application. How do I specify the provisioning profile to build the app with extension?
Related
I'm trying to generate an adhoc IPA from the command-line but I cannot get it to works.
I can however generate an adhoc IPA from Xcode doing Product -> Archive and Export... in Organizer.
Here is how I proceed to generate an IPA on the command-line
xcodebuild -project DemoApp.xcodeproj -scheme DemoApp archive -archivePath build/DemoApp.xcarchive -configuration Release
xcrun -sdk iphoneos PackageApplication -v build/DemoApp.xcarchive/Products/Applications/DemoApp.app -o build/DemoApp.ipa --sign "iPhone Distribution" --embed DemoApp_Adhoc.mobileprovision
When I install the generated IPA via iTunes, it doesn't install properly on the device. The icon is greyed out and the title says "Installing..." like here.
I've checked the provisioning profile, the UUID, etc.
I tried with shenzhen but got the same behavior.
Can you spot what I'm doing wrong?
Thanks!
Finally I did not find the problem with PackageApplication but as a workaround I used PROVISIONING_PROFILE and CODE_SIGN_IDENTITY environment variable with the xcodebuild step and it worked.
Here are the new commands:
xcodebuild -project DemoApp.xcodeproj -scheme DemoApp archive -archivePath build/DemoApp.xcarchive -configuration Release PROVISIONING_PROFILE="00000000-0000-0000-0000-000000000000" CODE_SIGN_IDENTITY="iPhone Distribution: Company Inc (XXXXXXXXXX)"
xcrun -sdk iphoneos PackageApplication -v build/DemoApp.xcarchive/Products/Applications/DemoApp.app -o build/DemoApp.ipa")
I am trying to build IPA from terminal. I tried the following steps:
Step 1:
/usr/bin/xcodebuild -target "appname" -sdk "iphoneos" -configuration Release
Step 2:
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "appname" -o "/Users/Pictures/" -sign "iPhone Developer:xxxxx" --embed /Users//Library/MobileDevice/Provisioning\ Profiles/xxxxxx.mobileprovision"
I didn't get any error but I am not getting any response. I have been waiting for more than 30 minutes. What am I missing here?
I have given a brief description of steps to follow, and parameters to pass while generating an ipa using terrminal below:
1) Go to the folder which contains the MyApp.xcodeproject file in terminal
2) By using the command given below you will get all the Targets of the application
/usr/bin/xcodebuild -list
3) After the above command is executed, you will get a list of targets of which you should select a specific target you need to generate .ipa
/usr/bin/xcodebuild -target $TARGET -sdk iphoneos -configuration Release
4) The above command builds the project and creates a .app file.The path to locate the .app file is"./build/Release-iphoneos/MyApp.app"
5) After Build gets succeeded then execute the following command to generate .ipa of the application using Developer Name and Provisioning Profile using the syntax below:
/usr/bin/xcrun -sdk iphoneos PackageApplication -v “${TARGET}.app” -o “${OUTDIR}/${TARGET}.ipa” –sign “${IDENTITY}” –embed “${PROVISONING_PROFILE}”
Explanation of each Parameter in the above syntax:
${TARGET}.app == Target path (ex :/Users/XXXXXX/desktop/Application/build/Release-iphoneos/MyApp.app) ${OUTDIR} == Select the output directory(Where you want to save .ipa file) ${IDENTITY} == iPhone Developer: XXXXXXX (XXXXXXXXXX)(which can be obtained from Keychain access) ${PROVISONING_PROFILE} == Path to the provisioning profile(/Users/XXXXXX/Library/MobileDevice/Provisioning Profiles/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.mobileprovision”)
6)ipa will be generated at selected output directory "${OUTDIR}"
I am trying to create ipa of my application using terminal.
I am able to successfully build my application, but when converting into an ipa, it throws the following error:
Check dependencies
Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “/Users/xxxx/Downloads/Certificate/xxxx.mobileprovision”, however, no such provisioning profile was found.
CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.0'
** ARCHIVE FAILED **
When I try to build the same application using X-Code, it works fine with the same provisioning profile.
The script I am running to build the ipa is
xcodebuild -verbose -project Build_Project_From_Terminal.xcodeproj -scheme nameOfProject -configuration Release -sdk iphoneos clean archive CONFIGURATION_BUILD_DIR="/Users/xxxx/Desktop/xxxx/Project Name/build" PROVISIONING_PROFILE="/Users/xxxxx/Downloads/Certificate/xxxxx.mobileprovision"
EDIT 1:
I have changed my script to
DEVELOPER_NAME="xxxxxxxxx" APP_NAME="xxxxxx"
xcodebuild archive -project $APP_NAME.xcodeproj -scheme $APP_NAME -archivePath ./$APP_NAME.xcarchive
xcodebuild -exportArchive -exportFormat APP -archivePath ./$APP_NAME.xcarchive -exportPath ./$APP_NAME.ipa
iphoneos PackageApplication -v ./$APP_NAME.app -o ./$APP_NAME.ipa --sign $DEVELOPER_NAME --embed ./*.mobileprovision
With this I am getting $APP_NAME.ipa.app as output. When I try to install this, it does not install at all.
Any help will be appreciated.
Please use an alternate method. This is a working example
DEVELOPER_NAME="Your apple developer name"
APP_NAME="application name"
xcodebuild archive -workspace $APP_NAME.xcworkspace -scheme $APP_NAME -archivePath ./$APP_NAME.xcarchive
xcodebuild -exportArchive -exportFormat APP -archivePath ./$APP_NAME.xcarchive -exportPath ./$APP_NAME.ipa
iphoneos PackageApplication -v ./$APP_NAME.app -o ./$APP_NAME.ipa --sign $DEVELOPER_NAME --embed ./*.mobileprovision
Save above shell script in a file (abc.sh) and save that file in your project folder along with your provision profile. Run this script using terminal will save ipa in the project directory.
I use to automate the build of my Adhoc and Distrib release of my apps with a simple script:
echo "***** xcodebuild: compile project"
xcodebuild -target "${PROJECT_NAME}" -sdk "${TARGET_SDK}" -configuration Release CONFIGURATION_BUILD_DIR="${PROJECT_BUILDDIR}"
echo "***** xcrun Package app (ipa file) - Adhoc release"
/usr/bin/xcrun -sdk iphoneos PackageApplication "${PROJECT_BUILDDIR}/${PROJECT_NAME}.app" -o
"${PROJECT_BUILDDIR}/${PROJECT_NAME}_adhoc.ipa" --sign
"${DEVELOPPER_NAME}" --embed "${ADHOC_PROVISONNING_PROFILE}"
echo "* xcrun Package app (ipa file) - AppStore release"
/usr/bin/xcrun -sdk iphoneos PackageApplication "${PROJECT_BUILDDIR}/${PROJECT_NAME}.app" -o
"${PROJECT_BUILDDIR}/${PROJECT_NAME}_appstore.ipa" --sign
"${DEVELOPPER_NAME}" --embed "${APPSTORE_PROVISONNING_PROFILE}"
It was working fine before. But then I installed Mac OS Maverik and I also updated my expired certificates & prov profiles. And since then, when I try to upload the generated IPA to iTunes Connect (for the Distribution release) or TestFlight (for the Adhoc release), I get this error message:
ERROR ITMS-9000: "Invalid Code Signing. The executable
'Payload/mosa_en_it.app/mosa_en_it' must be signed with the
certificate that is contained in the provisioning profile." at
SoftwareAssets/SoftwareAsset (MZItmspSoftwareAssetPackage)
But it's working when I do it manually on XCode (Archive->Distribute..).
Also, I don't know if it's related but I have lots of duplicates certificates: screenshot
(but I don't know how to delete them)
Thanks in advance for your help
I'm getting errors when trying to run /usr/bin/xcrun
/usr/bin/xcrun -sdk iphoneos PackageApplication /Users/xxxx/bamboo-agent-home/xml-data/build-dir/BEAM-IOS0-JOB1/archive.xcarchive/Products/Applications/MyApp.app -o /Users/xxxxx/bamboo-agent-home/xml-data/build-dir/BEAM-IOS0-JOB1/MyApp.ipa --sign "iPhone Distribution: MyComp" --embed /Users/xxxx/bamboo-agent-home/xml-data/build-dir/iOS_Team_Provisioning_Profile_.mobileprovision
and error is like this:
error: Unable to copy '/Users/xxxxx/bamboo-agent-home/xml-data/build-dir/iOS_Team_Provisioning_Profile_.mobileprovision'
to '/var/folders/1t/pgh7fy550vl8nrvtmqhvn_780000gn/T/cjftmH0k7i/Payload/MyApp.app/embedded.mobileprovision'
Any idea?
What's wrong with this case?
The provisioning file has been already embedded in your application (MyApp.app)
You can check this by extracting the .app using Archive Utility.
Remove the part --embed /Users/xxxx/bamboo-agent-home/xml-data/build-dir/iOS_Team_Provisioning_Profile_.mobileprovision from the command line and try again.