I am trying to Continuous integrate using Jenkins for Ios project. i am using below command to manually specify the code signing identity and provisioning profile.
/usr/bin/xcodebuild -workspace "Project.xcworkspace" -scheme
"projectTest" -archivePath build/Project -configuration Release
archive CODE_SIGN_STYLE=Manual
PROVISIONING_PROFILE=”CompanyNameQAAdhocDistribution”
CODE_SIGNING_IDENTITY="iPhone Developer: xxxxxxx xxxx (xxxxxxxxxx)"
** ARCHIVE SUCCEEDED **
For Exporting the IPA I am using below command.
/usr/bin/xcodebuild -exportArchive -archivePath
"build/Project.xcarchive" -exportPath "build/Project.ipa"
-exportOptionsPlist "Build/Project.xcarchive/Info.plist"
Error Message:
Error Domain=IDEProvisioningErrorDomain Code=9 ""ProjectTest.app"
requires a provisioning profile with the Push Notifications and Apple
Pay features." UserInfo={NSLocalizedDescription="ProjectTest.app"
requires a provisioning profile with the Push Notifications and Apple
Pay features., NSLocalizedRecoverySuggestion=Add a profile to the
"provisioningProfiles" dictionary in your Export Options property
list.}
** EXPORT FAILED **
Able to Export from IDE, But unable to do it via from command. Any help is Appreciated.
You can try specify correct profile in exportOptions.plist example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>teamID</key>
<string>xxxxx</string>
<key>provisioningProfiles</key>
<dict>
<key>*com.xxxxxx*</key>
<string>*profile name*</string>
</dict>
<key>method</key>
<string>development</string>
</dict>
</plist>
And then load it with:
xcodebuild -exportArchive -exportOptionsPlist "path/to/this.plist" ...
And make sure you use correct one. Its better to use IDs of profiles than names or delete all old profiles from disk.
In my case...I had the wrong bundle identifier under targetapp.plist --> provisioning profile(i.e targetapp bundle id and provisioning profile bundle id is different). After changing it to the correct one ( targetapp bundle id to provisionig profile) this issue got resolved
Try this solution. I am successfully Exported IPA in Xcode 9.0 and 9.2
Xcode Plugin of Jenkins not working with Xcode9.0
Related
I am using the xcodebuild for creating a package for publishing
The app bundle contains: the iOS app itself, the push notification extension, the watchos app with its extension.
The watchOS app is using the healthkit for retrieving heart rate data.
xcodebuild archive -configuration Release -workspace $(system.defaultworkingdirectory)/MyApp/MyApp.xcworkspace -scheme MyApp -archivePath $(system.defaultworkingdirectory)/MyAppArchive CODE_SIGNING_ALLOWED=NO
xcodebuild -exportArchive -archivePath $(system.defaultworkingdirectory)/MyAppArchive.xcarchive -exportPath $(system.defaultworkingdirectory)/Final -exportOptionsPlist $(system.defaultworkingdirectory)/MyApp/ExportOptions.plist
The ExportOptions.plist contains the info for signing the app
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>provisioningProfiles</key>
<dict>
<key>fit.myapp.watchkitapp.watchkitextension</key>
<string>ProvisioningProfileGUID1</string>
<key>fit.myapp.watchkitapp</key>
<string>ProvisioningProfileGUID2</string>
<key>fit.myapp.notification</key>
<string>ProvisioningProfileGUID3</string>
<key>fit.myapp</key>
<string>ProvisioningProfileGUID4</string>
</dict>
<key>signingCertificate</key>
<string>Apple Distribution: MY COMPANY</string>
<key>signingStyle</key>
<string>manual</string>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>MYTEAMID</string>
<key>uploadBitcode</key>
<false/>
</dict>
</plist>
The ipa file is successfully created but when the ipa file is uploaded (by Transporter app) the package analysis fails with the following errors:
Asset validation failed (90701)
Missing entitlement. watchOS app bundle 'MyApp.app/Watch/MyAppWatch.app/PlugIns/MyAppWatch Extension.appex' uses 'UIBackgroundModes' value 'workout-processing' without the required entitlement 'com.apple.developer.healthkit' signed into the bundle. (ID: cc87a6cd-2084-4712-9f45-b22b35e9574a)
Asset validation failed (90334) Invalid Code Signature Identifier. The
identifier "com.apple.WK" in your code signature for "MyAppWatch"
must match its Bundle Identifier "fit.myapp.watchkitapp" (ID:
bb9a56d3-949c-4b49-ad86-3cf7a26a91a2)
Extra note: If the build has performed directly in Xcode/Organizer then the issue is not present.
What am I missing?
How can I debug this kind of issues?
In my flutter project I'm using Codemagic as CI/CD tool.
After adding the flavor to the app, I started getting this error on one of the flavours.
> flutter build ios --release --no-codesign --build-name=0.0.1 --build-number=33 --flavor dev
Downloading ios tools... 2.4s
Downloading ios-profile tools... 1.5s
Downloading ios-release tools... 7.3s
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building se.getgaston.app for device (ios-release)...
Running pod install... 323.3s (!)
Running Xcode build...
Xcode build done. 875.6s
Built /Users/builder/clone/build/ios/iphoneos/Runner.app.
> xcode-project build-ipa --workspace /Users/builder/clone/ios/Runner.xcworkspace --scheme dev --config Release-dev
Archive Runner.xcworkspace
Execute "xcodebuild -workspace /Users/builder/clone/ios/Runner.xcworkspace -scheme dev -config Release-dev -archivePath build/ios/xcarchive/Runner_j1t8laki.xcarchive archive COMPILER_INDEX_STORE_ENABLE=NO DEVELOPMENT_TEAM=28759WZ2NP 'CODE_SIGN_IDENTITY=iPhone Distribution'"
❌ error: "Runner" requires a provisioning profile with the Push Notifications feature. Select a provisioning profile in the Signing & Capabilities editor. (in target 'Runner' from project 'Runner')
I've checked the certificate, provision profile and app id for both working flavour and one with signing issue and didn't find any difference.
This helped me.
My command was flutter build ipa --export-options-plist path/to/export.plist --build-number=123 --release --flavor=prod --dart-define=FLAVOR=prod
Sample export.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>compileBitcode</key>
<true/>
<key>method</key>
<string>enterprise</string>
<key>provisioningProfiles</key>
<dict>
<key>com.company.appname</key>
<string>provisioningProfiles name </string>
</dict>
<key>signingCertificate</key>
<string>iOS Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>xxxxxx</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>
For us, this was solved by adding a "Info.plist File" setting directly to all build schemes.
Before the change, the Info.plist was inherited from the Runner project:
To fix it, double-click on the top-level "Runner/info.plist":
Delete the text, and press return. This should clear the value for all projects.
Then, double-click in the same place, re-enter the same Runner/info.plist value again, and press return.
This should then update all the schemes to have the setting, rather than inheriting it.
The result should look like this:
This was caused by Codemagic's xcode-project use-profiles command. It expects each scheme to specify the Info.plist location, and doesn't parse inherited values.
Yesterday we upgraded from xcode 8.3.2 to version 9. And now our enterprise distribution apache cordova ios app refuses to build.
2017-09-21 07:37:16.787 xcodebuild[70400:217569] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/wj/yj3cfvh954gbc_btlhcrcx7nk7t4dj/T/App Name_2017-09-21_07-37-16.786.xcdistributionlogs'.
2017-09-21 07:37:16.938 xcodebuild[70400:217569] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7ff756bbdf70>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=(
"Error Domain=IDEProvisioningErrorDomain Code=9 \"\"App Name.app\" requires a provisioning profile.\" UserInfo={NSLocalizedDescription=\"App Name.app\" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the \"provisioningProfiles\" dictionary in your Export Options property list.}"
)}
error: exportArchive: "App Name.app" requires a provisioning profile.
Error Domain=IDEProvisioningErrorDomain Code=9 ""App Name.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="App Name.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}
** EXPORT FAILED **
Error: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,App Name.xcarchive,-exportOptionsPlist,/Users/Shared/Workspace/github/AppName/platforms/ios/exportOptions.plist,-exportPath,/Users/Shared/Workspace/github/AppName/platforms/ios/build/device
(I replaced the apps name with "App Name" for this question)
I have verified that all the certs and provisioning profiles are set in xcode. And the build.json is set. I'm not really a Mac guy and I'm stumped on what to do next.
-Edit, Downgrading xcode to 8.3.3 fixed the problem. Not an ideal solution but not much I can do.
If you specify your provisioning profile explicitly, like me. Like this in your Cordova build.json:
"ios": {
"debug": {
"codeSignIdentitiy": "iPhone Developer",
"developmentTeam":"MYTEAMID",
"packageType": "developer",
"iCloudContainerEnvironment": "Development"
},
"release": {
"codeSignIdentitiy": "iPhone Distribution",
"developmentTeam":"MYTEAMID",
"provisioningProfile": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"packageType": "ad-hoc",
"iCloudContainerEnvironment": "Production"
}
}
Please Note
iCloudContainerEnvironment = Production/Development is only required if you use push notifications
You need to explicitly set manual signing and provide the provisioning keys in your ExportOptions.plist that is generated by Cordova. Unfortunately Cordova is not currently generating all of the required keys.
Here is what it needs to look like, at least for me:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>compileBitcode</key>
<false/>
<key>method</key>
<string>ad-hoc</string>
<key>iCloudContainerEnvironment</key >
<string>Production</string>
<key>provisioningProfiles</key>
<dict>
<key>my.bundle.idenifier</key>
<string>My Provisioning Profile Name</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>YOURTEAMID</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>
The file Cordova generates # cordova/app/platforms/ios/exportOptions.plist looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>compileBitcode</key>
<false/>
<key>method</key>
<string>development</string>
<key>teamID</key>
<string>MYTEAMID</string>
</dict>
</plist>
notice it is missing the important bits that Xcode 9 requires.
I generated the correct file by archiving the build manually, then exporting it which also creates the exportOptions.plist that I now use as reference.
After digging deeper, I found that this cannot be fixed after running "Cordova add platform iOS", because it is generated during the build phase dynamically. I decided to fork the Cordova-ios repo and submit a pull request. You may use my fork directly, or wait until the pull request is merged.
Pull Request
https://github.com/apache/cordova-ios/pull/338/commits
Fork
https://github.com/jrryhrtn/cordova-ios
Usage notes from pull request
See example below, please note that the provisioning profile can be the name or UUID of the profile. Name is preferred for maintenence, as UUID changes each time to regenerate the profile.
{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam":"YOURTEAMID",
"provisioningProfile": "provisioning profile name or UUID",
"packageType": "development"
},
"release": {
"codeSignIdentity": "iPhone Distribution",
"developmentTeam":"YOURTEAMID",
"provisioningProfile": "provisioning profile name or UUID",
"packageType": "ad-hoc"
}
}
}
I plan to manually patch until the/a fix is merged into the next Cordova release. You will have to regenerate your iOS platform after the patch via "Cordova platform rm iOS" and then "Cordova platform add ~/forks/cordova-ios". ~/forks/cordova-ios my local path, use the path on your local machine where you downloaded the forked Cordova-ios repo.
Update
cordova-ios 4.5.2 has been officially released! Upgrade by running the following commands: "cordova platform rm ios", and then "cordova platform add ios#4.5.2"
Cheers!
While help is coming and you don't want to use Xcode directly (and I don't judge you 😉)... here is a temporary solution which worked fine for me:
remove ios
cordova platform rm ios
add ios from dev brunch where this issue already fixed.
(Later you will be able to use ios v4.6.0 or whatever final # is going to be)
cordova platform add https://github.com/apache/cordova-ios.git
I hope it will help you too! 🙂
For who land of the following error
error: exportArchive: exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided
All you need to do it this to create a build
ionic cordova build ios --prod --release -- --iCloudContainerEnvironment=Production
More info:
https://medium.com/#michele.patrassi/https-medium-com-michele-patrassi-add-icloud-icloudcontainerenvironment-to-your-ionic-ios-app-227300bf8896
After update Xcode8.3, the options '-exportSigningIdentity', '-exportProvisioningProfile' and '-exportFormat' are removed from 'xcodebuild -exportArchive'.
When i try to get a distribution app, i get the error below: xcodebuild: error: invalid option '-exportProvisioningProfile'.
So how can i get distribution MyApp.ipa from MyApp.xcarchive, when the project has set Automatic Signing Enabled?
Automatic Signing
Sounds like you want to create an IPA on the command line from an existing xcarchive. Since Xcode 7, the preferred way to do this is (from man xcodebuild):
xcodebuild -exportArchive -archivePath xcarchivepath -exportPath destinationpath -exportOptionsPlist path
So in your case:
xcodebuild -exportArchive -archivePath MyApp.xcarchive -exportPath MyApp.ipa -exportOptionsPlist exportOptions.plist
exportOptions.plist is a PLIST file that contains various parameters configuring the IPA export. See xcodebuild -help for all available options. You'll have to at least specifiy an entry for method (app-store, ad-hoc, enterprise etc. - defaults to development). If you just want to export for App-Store distribution, the file should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
</dict>
</plist>
Just replace this parameter :
-exportProvisioningProfile "MyProvisioningProfile"
with:
PROVISIONING_PROFILE_SPECIFIER="MyProvisioningProfile"
Hope it helps.
When you set Automatic Signing Enabled Xcode will automatically generate according provisioning profile.
But in order to make your command working you need to manually export the archive the first time.
Once it is done, Xcode will generate the provisioning profile (it starts by "XC" in the Apple Developer website).
Then your xcodebuild command will work.
Product -> Archive
Once it's done
Windows -> Organizer -> Select the last version -> Export (right pannel under Upload to App Store)
Keep me inform if you need additional informations.
I am building iOS project on command line using xcodebuild. Building with Release configuration is ok which created and App.xcarchive. Then I am trying to export archive for App Store IPA using,
xcodebuild -exportArchive -archivePath App.xcarchive -exportPath ~/output/ -exportOptionsPlist appstore.plist
My appstore.plist,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>teamID</key>
<string>T3AM1D</string>
<key>method</key>
<string>app-store</string>
</dict>
</plist
This gives me error,
error: exportArchive: The operation couldn’t be completed.(IDEDistributionErrorDomain error 3.)
Any help will be appreciated.
Finally I was able to solve this issue.
Solution Steps
Make sure all profiles and certificates are setup successfully in Mac
Make sure no red mark is shown from Xcode, For example Xcode->targets->Build settings ->Profiles and signing identity + team
Make sure that all targets including MainApp, Widgets, Extensions are also configures without issue
Make sure that all capabilities, appgroup and keychains are OK
Important: Make sure that from Xcode -> Product -> Archive -> export to App Store IPA ran at least one time
When running xcodebuild from command line, make sure that Xcode is closed
Hope this helps