简体   繁体   English

Xcode 8.3 xcodebuild exportArchive无法正常工作“找不到适用的设备”错误

[英]Xcode 8.3 xcodebuild exportArchive not working “No applicable devices found” error

I'm trying to create the ipa file like so: 我正在尝试像这样创建ipa文件:

xcodebuild -exportArchive 
-archivePath /tmp/public_1.46.0.2029_production.xcarchive 
    -exportPath /tmp/avner -exportOptionsPlist export.plist 

The export.plist is minimal (I've also tried stripping it completely and adding/removing various flags) export.plist是最小的(我也尝试完全剥离它并添加/删除各种标志)

I'm getting the following output 我得到以下输出

~/Developer/iOS-Scripts/Maxi : xcodebuild -exportArchive -archivePath /tmp/public_1.46.0.2029_production.xcarchive -exportPath /tmp//avner_avner -exportOptionsPlist export.plist 
2017-04-03 15:48:37.428 xcodebuild[5086:564094] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/rg/8ydk5h297ng50z_3dpkr5jx00000gn/T/InsertViewer_2017-04-03_15-48-37.428.xcdistributionlogs'.
1.2.840.113635.100.1.61
2017-04-03 15:48:46.363 xcodebuild[5086:564094] [MT] IDEDistribution: Step failed: <IDEDistributionThinningStep: 0x7fdc03a02110>: 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.}

** EXPORT FAILED **

EDIT 编辑

I've tried calling the build using the fastlane script wrapper but still getting the same error: 我尝试使用fastlane脚本包装器调用构建但仍然得到相同的错误:

./xcbuild-safe.sh -exportArchive -archivePath /tmp/public_1.46.0.2029_production.xcarchive -exportPath /tmp//avner_avner -exportOptionsPlist export.plist
+ xcodebuild -exportArchive -archivePath /tmp/public_1.46.0.2029_production.xcarchive -exportPath /tmp//avner_avner -exportOptionsPlist export.plist
2017-04-04 10:25:22.726 xcodebuild[16384:848977] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/rg/8ydk5h297ng50z_3dpkr5jx00000gn/T/InsertViewer_2017-04-04_10-25-22.726.xcdistributionlogs'.
1.2.840.113635.100.1.61
2017-04-04 10:25:32.156 xcodebuild[16384:848977] [MT] IDEDistribution: Step failed: <IDEDistributionThinningStep: 0x7fdde059ff50>: 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.}

** EXPORT FAILED **




~/Developer/iOS-Scripts/Maxi : cat xcbuild-safe.sh 
#!/bin/bash --login
# shellcheck disable=SC2155
# shellcheck disable=SC1090

# Originally from, https://stackoverflow.com/questions/33041109
# Modified to work in RVM and non RVM environments
#
# Xcode 7 (incl. 7.0.1) seems to have a dependency on the system ruby.
# xcodebuild has issues by using rvm to map to another non-system
# ruby. This script is a fix that allows you call xcodebuild in a
# "safe" rvm environment, but will not (AFAIK) affect the "external"
# rvm setting.
#
# The script is a drop in replacement for your xcodebuild call.
#
#   xcodebuild arg1 ... argn
#
# would become
#
#   path/to/xcbuild-safe.sh arg1 ... argn
#
# More information available here: https://github.com/fastlane/fastlane/issues/6495
# -----

which rvm > /dev/null
# shellcheck disable=SC2181
if [[ $? -eq 0 ]]; then
  echo "RVM detected, forcing to use system ruby"
  # This allows you to use rvm in a script. Otherwise you get a BS
  # error along the lines of "cannot use rvm as function". Jeez.
  [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

  # Cause rvm to use system ruby. AFAIK, this is effective only for
  # the scope of this script.
  rvm use system
fi

if which rbenv > /dev/null; then
  echo "rbenv detected, removing env variables"

  # Cause rbenv to use system ruby. Lasts only for the scope of this
  # session which will normally just be this script.
  rbenv shell system
fi

# Since Xcode has a dependency to 2 external gems: sqlite and CFPropertyList
# More information https://github.com/fastlane/fastlane/issues/6495
# We have to unset those variables for rbenv, rvm and when the user uses bundler
unset RUBYLIB
unset RUBYOPT
unset BUNDLE_BIN_PATH
unset _ORIGINAL_GEM_PATH
unset BUNDLE_GEMFILE
# Even if we do not use rbenv in some environments such as CircleCI,
# We also need to unset GEM_HOME and GEM_PATH explicitly.
# More information https://github.com/fastlane/fastlane/issues/6277
unset GEM_HOME
unset GEM_PATH

set -x          # echoes commands
xcodebuild "$@" # calls xcodebuild with all the arguments passed to this

~/Developer/iOS-Scripts/Maxi : 

And the plist (in its current incarnation) 和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>ad-hoc</string>
</dict>
</plist>

You could use the following wrapper of fastlane in order to avoid the Ruby problems on your build 您可以使用以下fastlane包装器来避免构建中的Ruby问题

https://github.com/fastlane/fastlane/blob/master/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh https://github.com/fastlane/fastlane/blob/master/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh

Replace: 更换:

xcodebuild -exportArchive -archivePath ${ARCHIVE} -exportPath ${OUTPUT_DIR} -exportOptionsPlist exportOptions.plist

By: 通过:

sh xcbuild-safe.sh -exportArchive -archivePath ${ARCHIVE} -exportPath ${OUTPUT_DIR} -exportOptionsPlist exportOptions.plist

It worked for me! 它对我有用!

I checked IDEDistribution.standard.log and found there suspicious string: 我检查了IDEDistribution.standard.log,发现有可疑的字符串:

Stderr:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: Mach-O universal file: /var/folders/3p/k32287w14n539kf36w55hldw0000gn/T/IDEDistributionThinningStep.C66/Payload/myApp.app/DeviceStatus for architecture armv7 is not a Mach-O file or an archive file.

Sth weird was included in app under Target > Build Phases > Copy Bundle Resources. 在目标>构建阶段>复制捆绑资源下的应用程序中包含了奇怪的东西。 It could be unnecessary bundles from SDK as well. 它也可能是SDK中不必要的捆绑包。 Deleting reference for this file helped. 删除此文件的引用有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 xcodebuild exportArchive:找不到适用的设备 - xcodebuild exportArchive: no applicable devices found 如何使用xcodebuild -exportArchive(Xcode8.3,自动签名)获取分发应用程序? - How to get a distribution app when using xcodebuild -exportArchive (Xcode8.3, Auto Signing)? Xcode 9:xcodebuild -exportArchive错误读取文件:info.plist - Xcode 9: xcodebuild -exportArchive Error Reading File: info.plist xcodebuild -exportArchive:键“方法”的 exportOptionsPlist 错误:预期 {} 之一 - xcodebuild -exportArchive: exportOptionsPlist error for key 'method': expected one of {} xcodebuild -exportArchive 失败并出现错误 Locating signing assets failed - xcodebuild -exportArchive fails with error Locating signing assets failed xcodebuild exportArchive为nil:NilClass的未定义方法小写 - xcodebuild exportArchive undefined method downcase for nil:NilClass Xcode 8.3 / Xcode 9.0 刷新配置文件设备 - Xcode 8.3 / Xcode 9.0 Refresh provisioning profile devices 无法将存档导出到ipa(找不到适用的设备) - Failed to export archive to ipa (No applicable devices found) Xcode 8.3自动完成和语法高亮不起作用 - Xcode 8.3 autocomplete and syntax highlighting not working 故事板无法正常工作,Xcode 8.3 beta 3 - Storyboard not working as expected, Xcode 8.3 beta 3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM