为什么在使用gym构建项目时需要添加use_legacy_build_api:true?

3

为什么在使用 gym 构建项目时需要添加 use_legacy_build_api: true?

我使用的是 Xcode 7.3 和 gym 1.6.2,

我正在构建一个新项目(OC 或 Swift 都一样),

以下是错误输出:

2016-04-22 18:45:46.071 xcodebuild[135:10371572] [MT] PluginLoading: Required plug-in compatibility UUID F41BD31E-2683-44B8-AE7F-5F09E919790E for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/BBUFullIssueNavigator.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-04-22 18:45:46.246 xcodebuild[135:10371572] ### Failed to load Addressbook class CNContactNameFormatter
2016-04-22 18:45:46.300 xcodebuild[135:10371572] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/4w/fpkx9n7s3gnbcxfym8mqr18m0000gn/T/GymDemo_2016-04-22_18-45-46.299.xcdistributionlogs'.
2016-04-22 18:45:46.585 xcodebuild[135:10371572] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7ff847a3e450>: Error Domain=IDEDistributionErrorDomain Code=1 "(null)"
error: exportArchive: The operation couldn’t be completed. (IDEDistributionErrorDomain error 1.)

Error Domain=IDEDistributionErrorDomain Code=1 "(null)"

** EXPORT FAILED **
[18:45:46]: Exit status: 70

[!] Error packaging up the application
2个回答

0

标志use_legacy_build_api仅适用于运行Xcode 6或更早版本的情况。

正如Felix KrauseGithub上所解释的:

什么是use_legacy_build_api?
它使用的是Xcode 6构建API,该API已不再得到官方支持。

发生的事情是,在Xcode 6和7之间进行了几个更改以改进构建/打包过程,因此为了适应新流程并仍能够使用旧流程,fastlane引入了这个新标志,基本上通知要使用哪个命令。

Xcode 7

由于您正在使用Xcode 7,因此需要指定要导出应用程序的方式,这与您使用Xcode本身时需要做出的选择相同: Exporting archive using Xcode

您也可以在苹果文档导出您的应用中了解更多有关导出方法的信息。

Gym

如上所述,使用Fastlane时,您应相应地指定export_method字段:

gym(export_method:"app-store|ad-hoc|package|enterprise|development|developer-id")

您可以在fastlane操作文档中了解有关Gym及其参数的更多信息。

  • use_legacy_build_api: [已弃用!]不再使用此选项,因为它已被苹果弃用 - 不再使用此选项,因为它已被苹果弃用
  • export_method: 用于导出存档的方法。有效值为:app-store、ad-hoc、package、enterprise、development、developer-id

0

我不知道为什么会出错,但我只是使用“fastlane init”并更改了“fastlane”,现在一切都正常了。这是我的“fastfile”:

desc "Deploy a new version to the App Store"
  lane :appstore do
    # match(type: "appstore")
    # snapshot
    #sigh
    gym(
      scheme: "myscheme_iOS",
      export_method:"app-store",
      output_directory:"./fastlane",
      output_name:"myipa_20160607030055",
      codesigning_identity:"iPhone Distribution: Jack Zhou (9R46C82WH7)"
    ) # Build your app - more options available
    #deliver(force: true)
    # frameit
  end

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接