2

I have a lib that has targets for tvOS and iOS on the same workspace.

When I build for tvOS, it gives me an error saying:

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

The command Fastlane is using to run the build is: 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

And when I run it in verbose mode, the part that seems to be showing the error is:

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".

It is selecting a xib that, at the dependency (Clappr), doesn't belong to tvOS target.

Also, when I try to build using the iOS target, it answers me the following:

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

The fastlane lane used to run the build for tvOS is the following:

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

Environment info:
* iOS target has build seating valid architectures with the value arm64 arm64e armv7 armv7s and tvOS has value: arm64
* Fastlane version 2.123.0
* Cocoapods version 1.6.1
* make_universal_framework uses lipo to build

jademcosta
  • 1,528
  • 15
  • 23
  • What’s your target OS for iOS/tvOS? Is a file missing a UIKit import that may have been relying on the framework to import? Note that tvOS only supports arm64 also. – Daniel Storm May 27 '19 at 17:58
  • You mean deployment target? It's 10.0. I wasn't able to find a missing file or something like that :( – jademcosta May 29 '19 at 13:07

1 Answers1

2

To be completely honest, I don't know why it is failing, although I found a solution.

This answer led me to the right direction: https://github.com/Webtrekk/webtrekk-ios-sdk/issues/55#issuecomment-481720922

I know, my problem has nothing to do with the one written on the GitHub issue, but it gave me an idea to solve it. I went to menu

File -> Project(Workspace) Settings -> Workspace settings -> Build System => 'Legacy Build System'

And it solved the problem!

It seems to be a difference on the build system, but I haven't found documentation confirming it.

jademcosta
  • 1,528
  • 15
  • 23