Xcode export Step failed: IDEDistributionThinningStep - ios

I'm using Xcode version 8.2.1 and Mac OS Sierra 10.12.2
Having issues exporting archive using Xcode build command:
xcodebuild -exportArchive -archivePath {archivePath} -exportPath {exportPath} -exportOptionsPlist {exportOptionsPlistPath}
While running this command i'm getting this issue:
[MT] IDEDistribution: Step failed: <IDEDistributionThinningStep: 0x7fa4d888ee20>: Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}
error: exportArchive: No applicable devices found.
Also when trying to export manually, and choosing export for specific device i'm getting this error :
The exportOptionsPlist file looks as follow:
<?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>enterprise</string>
</dict>
</plist>
I tried to play with the thinning param but nothing helped.
Thanks in advance

Are you still having this problem?
I recently run into this issue ... and I am still working on it. So far, I see a problem in your exportOptionsPlist file, it should also include a teamID, I mean:
<?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>enterprise</string>
<key>teamID</key>
<string>XX..XX</string>
</dict>
</plist>
Also, the error No applicable devices found might appear if one of the framework/library you app depends on, does not support bitcode but your app requires it.
I recommend you to follow this issue in fastline where it is described how to fully debug this error: https://github.com/fastlane/fastlane/issues/8737.
Regards.

Related

Xcode9 iOS export archive fails on correct format

I have an iOS app that is building on both xcode8 (Sierra) and on xcode9 (High Sierra).
When I'm doing exportArchive it passes on xcode8 but fails on xcode9.
I have the provisioningProfiles section in my plist, and the failure in on correct format.
<?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>enterprise</string>
<key>teamID</key>
<string><Our teamID></string>
<key>signingStyle</key>
<string>manual</string>
<key>signingCertificate</key>
<string><Our signingCertificate></string>
<key>provisioningProfiles</key>
<dict>
<key><Our bundleID></key>
<string><App Name></string>
</dict>
</dict>
</plist>
I have another app that I'm building and everything is fine. Both xcode8 and xcode9. All the IDs are correct.
This the error that I'm getting:
2018-04-11 02:16:07.014 xcodebuild[25609:10463244] [MT] IDEDistribution: Step failed: <IDEDistributionPackagingStep: 0x7fe89376c690>: Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value., NSFilePath=/var/folders/y0/5_70v74n4830lyzmjs08pm4w0000gn/T/ipatool-json-filepath-KoS1w8}
[09:16:07][iOS: Build release version] ** EXPORT FAILED **
[09:16:07][iOS: Build release version] error: exportArchive: The data couldn’t be read because it isn’t in the correct format.
[09:16:07][iOS: Build release version]
[09:16:07][iOS: Build release version]
[09:16:07][iOS: Build release version] Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value., NSFilePath=/var/folders/y0/5_70v74n4830lyzmjs08pm4w0000gn/T/ipatool-json-filepath-KoS1w8}
Thanks.
I was facing the similar error, You can try to append following key-pair. This had fixed my error.
<key>compileBitcode</key>
<false/>
In my case was an issue with rvm I fixed it following the instructions on this blog entry:
https://egeek.me/2018/04/14/ipa-export-error-in-xcode-and-ruby/
For those who experience this error while use fastlane, add to gym
export_options: {
compileBitcode: false
},
option
Discussion thread

error: exportArchive: The operation couldn’t be completed. (IDEDistributionErrorDomain error 3.)

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

Jenkins automated iOS build has SwiftSupport folder missing

Currently I'm having an issue that when jenkins executes a job to generate a .ipa to submit to testflight, Apple sends me the following email:
We have discovered one or more issues with your recent delivery for "XXXXX". To process your delivery, the following issues must be corrected:
Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
Once these issues have been corrected, you can then redeliver the corrected binary.
I opened the .ipa that was uploaded and it's true this folder isn't there.
So I tried doing the build manually... I used the same workspace that jenkins uses to generate the builds, and I manually generated a build to upload to AppStore and everything went well...
What might be the problem with the automated build? Is there a step that jenkins might be missing?
Is anyone having the same issue??
Archive the application
xcodebuild \
-workspace "${WORKSPACE_FILE}" \ # only if you are using workspace
-scheme "${SCHEME_NAME}" \
-sdk "${TARGET_SDK}" \
-archivePath "${PROJDIR}/Build/${SCHEME_NAME}.xcarchive" \
-configuration Release \
archive
Export the archive to an ipa
xcodebuild \
-exportArchive \
-archivePath "${PROJDIR}/Build/${SCHEME_NAME}.xcarchive" \
-exportOptionsPlist "${PROJDIR}/exportOptions.plist" \
-exportPath "${PROJDIR}/Release"
exportOptions.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>method</key>
<string>app-store</string>
</dict>
</plist>
Are you specifying the -exportOptionsPlist option on your xcodebuild command?
See xcodebuild -help for the available keys, but you probably want a plist with at least he method key set to "app-store", 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>

iOS code signing external IPA file

I have received an IPA file of an iOS app from another team, I need to code sign the IPA file in order to run the app on my device.
I unzipped the IPA file, and it only contains .app file. How could I code sign the IPA file then ? Could some one provide me an step by step tutorial please?
(I have my development certificate, provisioning profile, registered device ready.)
===== UPDATE =====
What I am asking is almost the same as this one, the difference is that when I unzip the IPA, it is an app file which is different than the linked question.
You should create a ResourceRules.plist and Entitlements.plist with your credentials. After you create and update those files, delete _CodeSignature folder inside the .app file. Then you can run the following process from the command line:
codesign -f -s 'iPhone Distribution: YOUR_DISTRIBUTION_PROFILE_NAME_HERE' --resource-rules ResourceRules.plist --entitlements Entitlements.plist PATH_TO_APP_FILE
Entitlements.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>application-identifier</key>
<string>XXXXXXXXXX.com.xxx.app</string>
</dict>
</plist>
ResourceRules.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>rules</key>
<dict>
<key>.*</key>
<true/>
<key>Info.plist</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>ResourceRules.plist</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>100</real>
</dict>
</dict>
</dict>
</plist>

How to generate entitlements in xml format without xcode?

I have to build ios application, but without using xcode.
Problem is in pass entitlements to application.
My entitlements file looks 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>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.domain</string>
</array>
</dict>
</plist>
and xcode formats it to this (.xcent file):
<?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>application-identifier</key>
<string>A1B2C3D4E5.product.name</string>
<key>com.apple.developer.team-identifier</key>
<string>E5D4C3B2E1</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>A1B2C3D4E5.com.domain</string>
</array>
</dict>
</plist>
by using the command:
builtin-productPackagingUtility app.entitlements -entitlements -format xml -o ${HOME}/Library/Developer/Xcode/DerivedData/app//Build/Intermediates/app.build/Debug-iphoneos/app.build/app.xcent
Can anybody explain what exactly this command does and how can i invoke it manually? Or how can i simulate this command call by my hand?
Thanks.
If you can use xcodebuild, builtin-productPackagingUtility will be invoked as a step. You simply need to supply entitlements as a build setting variable in the command line.
This library will create a xcent file you can use for codesigning.
https://github.com/sotownsend/iarrogant
Note: I haven't tested the library.
You can also grab the resulting xcent file from an ipa created with xcodebuild and use that to sign future releases. You would have to keep these files in sync as your entitlements change.

Resources