ios - 在 Xcode 10.2.1 上构建,tvOS 和 iOS 项目失败

标签 ios swift xcode swift5 xcode10.2

我有一个库,在同一工作区上有 tvOS 和 iOS 的目标。

当我为 tvOS 构建时,它给我一个错误:

The following build commands failed:
    CompileSwift normal arm64
    CompileXIB /Users/.../<project_folder>/Pods/Clappr/Sources/Clappr_iOS/Classes/Plugin/Core/MediaControl/Seekbar/Views/SeekbarView.xib
    CompileSwift normal arm64

FaSTLane 用于运行构建的命令是: set -o pipefail && xcodebuild -workspace "<project_name>.xcworkspace" -scheme "<scheme_name>_tvOS" -configuration "Release" -sdk "appletvos" -derivedDataPath "build/tvOS-appletvos" clean build GCC_PREPROCESSOR_DEFINITIONS='${inherited}' BITCODE_GENERATION_MODE=bitcode ENABLE_BITCODE=YES

当我在 verbose 中运行它时模式下,似乎显示错误的部分是:

CompileXIB /Users/<project_folder>/Pods/Clappr/Sources/Clappr_iOS/Classes/Plugin/Core/MediaControl/Seekbar/Views/SeekbarView.xib (in target: Clappr-iOS)
    cd /Users/<project_folder>/Pods
    export XCODE_DEVELOPER_USR_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/..
    /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --module Clappr --output-partial-info-plist /Users/<project_folder>/build/tvOS-appletvos/Build/Intermediates.noindex/Pods.build/Release-appletvos/Clappr-iOS.build/SeekbarView-PartialInfo.plist --auto-activate-custom-fonts --target-device tv --minimum-deployment-target 10.0 --output-format human-readable-text --compile /Users/<project_folder>/build/tvOS-appletvos/Build/Products/Release-appletvos/Clappr-iOS/Clappr.framework/SeekbarView.nib /Users/<project_folder>/Pods/Clappr/Sources/Clappr_iOS/Classes/Plugin/Core/MediaControl/Seekbar/Views/SeekbarView.xib
/* com.apple.ibtool.errors */
/Users/<project_folder>/Pods/Clappr/Sources/Clappr_iOS/Classes/Plugin/Core/MediaControl/Seekbar/Views/SeekbarView.xib: error: iOS xibs do not support target device type "tv".

它选择的 xib 在依赖项 ( Clappr ) 处不属于 tvOS 目标。

此外,当我尝试使用 iOS 目标进行构建时,它回答了我以下问题:

The following build commands failed:
    CompileSwift normal armv7
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
    CompileSwift normal arm64
    CompileSwift normal armv7
    CompileSwift normal arm64

用于运行 tvOS 构建的 faSTLane channel 如下:

private_lane :xc_build do |params|
  xcodebuild(
    workspace: "ProjectName.xcworkspace",
    scheme: params[:scheme],
    configuration: 'Release',
    sdk: params[:sdk],
    derivedDataPath: params[:derivedDataPath],
    clean: true,
    build: true,
    xcargs: params[:xcargs]
  )
end

lane :build_tvos do
  remove_previous_builds_of(platform: "tvOS")

  #It breaks on the following command
  xc_build(
    scheme: 'ProjectScheme_tvOS',
    sdk: 'appletvos',
    derivedDataPath: 'build/tvOS-appletvos',
    xcargs: "GCC_PREPROCESSOR_DEFINITIONS='${inherited}' BITCODE_GENERATION_MODE=bitcode ENABLE_BITCODE=YES"
  )

  xc_build(
    scheme: 'ProjectScheme_tvOS',
    sdk: 'appletvsimulator',
    derivedDataPath: 'build/tvOS-appletvsimulator',
    xcargs: "GCC_PREPROCESSOR_DEFINITIONS='${inherited}' BITCODE_GENERATION_MODE=bitcode ENABLE_BITCODE=YES"
  )

  #This uses lipo to build universal frameworks
  make_universal_framework(
    universal_framework_folder: "Framework/tvOS",
    device_framework_folder: "build/tvOS-appletvos/Build/Products/Release-appletvos",
    simulator_framework_folder: "build/tvOS-appletvsimulator/Build/Products/Release-appletvsimulator"
  )
end

环境信息:
* iOS 目标已构建座位 valid architectures值为 arm64 arm64e armv7 armv7s tvOS 的值是:arm64
* FaSTLane版本2.123.0
* Cocoapods版本1.6.1
* make_universal_framework使用lipo构建

最佳答案

说实话,我不知道为什么会失败,尽管我找到了解决方案。

这个答案引导我走向正确的方向:https://github.com/Webtrekk/webtrekk-ios-sdk/issues/55#issuecomment-481720922

我知道,我的问题与 GitHub 问题上写的问题无关,但它给了我解决它的想法。我去了菜单

文件 -> 项目(工作区)设置 -> 工作区设置 -> 构建系统 =>“旧版构建系统”

它解决了问题!

这似乎是构建系统上的差异,但我还没有找到证实这一点的文档。

关于ios - 在 Xcode 10.2.1 上构建,tvOS 和 iOS 项目失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56330084/

相关文章:

ios - 错误 : no such file or directory

ios - 为什么非零数字无法将 BOOL 属性设置为 YES?

ios - 使用 'Codable'解码数据

html - 如何在 UIWebView 中显示 HTML 代码?

ios - 快照套件 : How to set layout constraints for items in a TableViewCell programatically

ios - 将图像和标签保存并检索到下一个 View 。代码

ios - Swift:UITableView 未加载数据

ios - 回到rootViewController,viewDidAppear在viewDidLoad之前被调用

objective-c - 导出视频时出现自定义 CMTimeRange 问题

ios - Swift - UISlider 不会改变它的值