针对tvOS和iOS的项目无法在Xcode 10.2.1上构建

时间:2019-05-27 17:11:51

标签: 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".

正在选择一个依存关系(Clappr)不属于tvOS目标的xib。

此外,当我尝试使用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通道如下:

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进行构建

1 个答案:

答案 0 :(得分:0)

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

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

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

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

它解决了问题!

在构建系统上似乎有所不同,但是我还没有找到证实它的文档。