Exporting xcarchive and IPA in xcode 6.4 - ios

I want to make build scripts for my app to export xcarchive and ipa files.
I used following command to export xcarchive:
xcodebuild -scheme myscheme archive -archivePath path/appname.xcarchive
Which gave me an xcarchive file and I used following to export IPA file:
xcodebuild -exportArchive -exportFormat IPA -exportProvisioningProfile *** -archivePath path/appname.xcarchive -exportPath path/appname.ipa
And I got following error regardless of what I typed in front of exportProvisioningProfile.
no provisioning profile matches ***
** EXPORT FAILED **
What should I write insted of *** in front of exportProvisioningProfile?

The name of the provisioning profile. This is the same name as seen on the page (https://developer.apple.com/account/ios/profile/profileList.action). If you have spaces in that name you need to write the name with quotes. E.g.
xcodebuild -exportArchive -exportFormat IPA -archivePath
MyMobileApp.xcarchive -exportPath MyMobileApp.ipa
-exportProvisioningProfile 'MyMobileApp Distribution Profile'
It may also be that you have not downloaded the provisioning profile, try re-downloading it and opening it with Xcode to install it in the correct location.

Related

Not able to create IPA using xcodebuild command through jenkins shell script

I am trying to create an IPA file using below command on Jenkin
xcodebuild -exportArchive -archivePath export/MySampleApp.xcarchive -exportPath export/ -exportOptionsPlist export/export_options.plist
But it gives me error
+ xcodebuild -exportArchive -archivePath export/MySampleApp.xcarchive -exportPath export/ -exportOptionsPlist export/export_options.plist
2018-06-19 19:16:07.324 xcodebuild[81214:2060182] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/y5/1qdx7j6j2tdb1j6g3vvg_xww0000gn/T/MySampleApp_2018-06-19_19-16-07.323.xcdistributionlogs'.
2018-06-19 19:17:20.872 xcodebuild[81214:2060182] [MT] IDEDistribution: Step failed: <IDEDistributionPackagingStep: 0x7ff2b080be50>: Error Domain=IDEDistributionPipelineErrorDomain Code=0 "Code signing "libswiftCore.dylib" failed." UserInfo={NSLocalizedDescription=Code signing "libswiftCore.dylib" failed., NSLocalizedRecoverySuggestion=View distribution logs for more information.}
error: exportArchive: Code signing "libswiftCore.dylib" failed.
Error Domain=IDEDistributionPipelineErrorDomain Code=0 "Code signing "libswiftCore.dylib" failed." UserInfo={NSLocalizedDescription=Code signing "libswiftCore.dylib" failed., NSLocalizedRecoverySuggestion=View distribution logs for more information.}
** EXPORT FAILED **
I was able to create an archive file using below command
xcodebuild -scheme "MySampleApp" -sdk iphoneos -target MySampleApp -destination "generic/platform=iOS" -archivePath export/MySampleApp.xcarchive archive DEVELOPMENT_TEAM="QPG8EMUULT" PROVISIONING_PROFILE="efb8da47-3b87-4880-82e8-4967167bb2d3" CODE_SIGNING_REQUIRED=NO
Can anyone please let me know what could be the issue ?
Keychain was locked on Jenkin server thats why it was not able to code sign.
Unlocked it with below command before xcodebuild command
security unlock-keychain -p yourPassword
Now its working good.
I met the problem when :
xcodebuild archive using Xcode 10
xcode-select to Xcode 9
try to run xcodebuild -exportArchive
so I xcode-select to Xcode 10 and problem solved

Xcode 9.2 Archive Succeed but unable to Export IPA

I am trying to continuous integrate for an Enterprise IOS Build for AdhocProd. Using below command for Build and Archive .
Build Command:
/usr/bin/xcodebuild -workspace "Project.xcworkspace" -scheme
"ProjectiOSPROD" -archivePath build/ProjectiOS -configuration Release
archive CODE_SIGN_STYLE=Manual
PROVISIONING_PROFILE=”CompanyNameProdAdhocDistribution”
CODE_SIGNING_IDENTITY="iPhone Developer: Build Machine(XXXXXX)"
PRODUCT_BUNDLE_IDENTIFIER="com.Companyname.prod.ProjectiOS"
OUTPUT:
** ARCHIVE SUCCEEDED **
Export Command:
/usr/bin/xcodebuild -exportArchive -archivePath "build/ProjectiOS.xcarchive" -exportPath "build/ProjectiOS.ipa" -exportOptionsPlist"../../ExportOptions.plist"
This Plist is ExportOptions.Plist taken from the xcode IDE. and using it for jenkins work space
Output:
error: exportArchive: SDWebImage.framework does not support provisioning profiles.
Error Domain=IDEProvisioningErrorDomain Code=10 "SDWebImage.framework does not support provisioning profiles." UserInfo={NSLocalizedDescription=SDWebImage.framework does not support provisioning profiles., NSLocalizedRecoverySuggestion=SDWebImage.framework does not support provisioning profiles, but provisioning profile CompanyNameProdAdhocDistribution has been manually specified. Remove this item from the "provisioningProfiles" dictionary in your Export Options property list.}
error: exportArchive: Stripe.framework does not support provisioning profiles.
Error Domain=IDEProvisioningErrorDomain Code=10 "Stripe.framework does not support provisioning profiles." UserInfo={NSLocalizedDescription=Stripe.framework does not support provisioning profiles., NSLocalizedRecoverySuggestion=Stripe.framework does not support provisioning profiles, but provisioning profile CompanyNameProdAdhocDistribution has been manually specified. Remove this item from the "provisioningProfiles" dictionary in your Export Options property list.}
provisioningProfiles dictionary is already present in Property list. If i removed this it says add this to Property list.
Any Suggestions would be greatly Appreciated.
You have to generate and export the IPA manually with Xcode9.2. This will create a file name ExportOptions.plist in the exported folder.
Copy that file to workspace root folder.
Write below command in Execute shell.
xcodebuild -exportArchive -archivePath ${WORKSPACE}/build/YourProject.xcarchive -exportPath ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/archive -exportOptionsPlist ${WORKSPACE}/ExportOptions.plist

Including .dSYM file inside .ipa file

For iOS builds with Xcode 8, is it possible to include a generated .dSYM file into the .ipa file?
I'm building my ipa files like this (in Jenkins but it shouldn't matter) ...
# Create xarchive
xcodebuild
-workspace /sourcepath/myapp.xcworkspace
-sdk iphoneos
-scheme 'Distribution Production'
-configuration 'Distribution Production'
-archivePath '/outputpath/Distribution Production-iphoneos/myapp.xcarchive'
'CODE_SIGN_IDENTITY=********'
'PROVISIONING_PROFILE=App Enterprise PRD'
DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
archive
# Create IPA
xcodebuild
-exportArchive
-archivePath '/outputpath/Distribution Production-iphoneos/myapp.xcarchive'
-exportOptionsPlist '/outputpath/Distribution Production-iphoneos/export_options.plist'
-exportPath '/outputpath/Distribution Production-iphoneos'
This generates an xarchive and lastly an ipa file. The xarchive then contains the .dSYM file but I'd like to have the .dSYM in the IPA file instead. Is this possible?
I tried using these arguments in addition when creating the xarchive:
'DWARF_DSYM_FOLDER_PATH=/outputpath/Distribution Production-iphoneos'
'DWARF_DSYM_FILE_NAME=Distribution Production.dSYM'
... but then the xarchive doesn't contain the dSYM and it isn't being found anywhere else.

Cannot generate adhoc IPA from command-line but it works in Xcode

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")

Build Project From Terminal throws Provisioning Profile error

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.

Resources