I am seeing this error when I try to export an archive:
2017-03-08 16:33:01.413 xcodebuild[61048:2742229] [MT] IDEDistribution: Step failed: <IDEDistributionThinningStep: 0x7fe3d72312f0>: Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}
error: exportArchive: No applicable devices found.
Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo={NSLocalizedDescription=No applicable devices found.}
I'm not doing any app thinning:
<!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>enterprise</string>
<key>teamID</key>
<string>MYTEAMID</string>
<key>thinning</key>
<string><none></string>
<key>uploadBitcode</key>
<false/>
</dict>
</plist>
When I look in the directory mentioned here:
2017-03-21 08:47:20.275 xcodebuild[24493:1421657] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/36/28z3md3x08xcljbsh6tvv4xrcr93wf/T/UniversalFree_2017-03-21_08-47-20.274.xcdistributionlogs'.
I see this error in the IDEDistribution.standard.log
2017-03-21 15:47:25 +0000 Scanning IPA...
2017-03-21 15:47:48 +0000 /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:2341:in `platformIdentifierForVersionMinLoadCommand': undefined method `downcase' for nil:NilClass (NoMethodError)
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1236:in `block in GetMachOImagesFromOToolInfoForFile'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1196:in `each'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1196:in `GetMachOImagesFromOToolInfoForFile'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1294:in `MakeFileSystemNode'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1322:in `block in MakeFileSystemNode'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1321:in `each'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1321:in `MakeFileSystemNode'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1322:in `block in MakeFileSystemNode'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1321:in `each'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1321:in `MakeFileSystemNode'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1085:in `initialize'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1871:in `new'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:1871:in `ProcessIPA'
from /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool:2428:in `<main>'
2017-03-21 15:47:49 +0000 [MT] /Applications/Xcode-7.app/Contents/Developer/usr/bin/ipatool exited with 1
The export then fails. How do I deal with this?
Answering my own question, since I could not find a direct answer online. While it's not entirely clear to me what is causing this, as the stack trace indicates the issue emerges within the ipatool
in the GetMachOImagesFromOToolInfoForFile
. There appears to be an expectation that the loadCommands
for every item it processes will have a key of the form LC_VERSION_MIN_(.+)
but this does not appear to be the case for all items (if someone can determine why and update this answer, much appreciated). In any event, you can make the following modifications to ipatool
to "fix" this issue (new file is the left file).
TL/DR: Edits for /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool
For Xcode 7...
608,610d607
< if (self.machoFile == nil)
< return "<MachOImage nil #{self.arch}>"
< end
1239,1242d1235
< if (versionMinLoadCommandName == nil)
< next
< end
1302c1295
< if (machoImages && machoImages.length > 0)
---
> if machoImages
And for Xcode 8...
750,752d749
< if (self.machoFile == nil)
< return "<MachOImage nil #{self.arch}>"
< end
1438,1440d1434
< if (versionMinLoadCommandName == nil)
< next
< end
1510c1504
< if (machoImages && machoImages.length > 0)
---
> if machoImages