0

In our project we have 3 whitelabels. We added a companion watch app (with extension) for each of these targets. So far so good.

Now I wanted to integrate the new target isn't our pod-file. To make it easy to modify I created a pseudo-inheritance structure:

# Uncomment the next line to define a global platform for your project
# platform :ios, '11.0'
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'


def base_pods
  # Pods for App
  pod 'SwiftLint', '0.39.2'
  pod 'JWTDecode', '2.4.1'
  ...
end

def base_app_pods
  platform :ios, '11.0'

  base_pods

  # Pods for the Phone App
  ...
end

def base_watch_pods
  platform :watchos, '6.2'

  base_pods

  # Pods for the Watch App
  ...
end

def tests
  unit_tests
  ui_tests
end

def unit_tests
  target 'UnitTests' do
    inherit! :search_paths
    ...
  end
end

def ui_tests
  target 'UITests' do
    inherit! :search_paths
    base_app_pods
    ...
  end
  target 'OtherUITests' do
    inherit! :search_paths
    base_app_pods
    ...
  end
end

target 'Target1' do
  base_app_pods
  tests
end

target 'Target2' do
  base_app_pods
end

target 'Target3' do
  base_app_pods
end

target 'Target1 Watch Extension' do
  base_watch_pods
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "SpecificPod"
      target.build_configurations.each do |config|
        config.build_settings['ENABLE_BITCODE'] = 'NO'
      end
    end
    target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '5.0'
    end
  end
  installer.pods_project.build_configurations.each do |config|
    if config.name == 'Release'
      config.build_settings['ARCHS'] = 'arm64'
    end
  end
end

I ran pod install, it ran through. Then I build the app with Xcode, it also went trough.

But then I tried running it with fastlane gym. Our lane for that looks like this

desc "build app"
lane :buildApp do
  gym(
    workspace: ENV['WORKSPACE'],
    scheme: ENV['SCHEME'],
    export_options: ENV['PATH_TO_EXPORT_OPTIONS']
  )
end

While building like this, I got this error:

[10:41:46]: ▸ ⚠️  ld: directory not found for option '-F/Users/user/Library/Developer/Xcode/DerivedData/Target1-csmvfsiijdtrxkeiafycryotnjmz/Build/Intermediates.noindex/ArchiveIntermediates/Target1/BuildProductsPath/Release-watchos/JWTDecode-watchOS'
[10:41:46]: ▸ ⚠️  ld: directory not found for option '-F/Users/user/Library/Developer/Xcode/DerivedData/Target1-csmvfsiijdtrxkeiafycryotnjmz/Build/Intermediates.noindex/ArchiveIntermediates/Target1/BuildProductsPath/Release-watchos/KeychainAccess-watchOS'
[10:41:46]: ▸ ❌  ld: framework not found JWTDecode
[10:41:46]: ▸ ❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas, what could cause this and/or how to solve this?

  • Xcode Version: 11.5
  • Fastlane Version: 2.149.1
  • Cocoapods Version: 1.9.1

1 Answers1

0

Ok, I fixed it buy removing the hard-set architecture for watch-targets:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "SpecificPod"
      target.build_configurations.each do |config|
        config.build_settings['ENABLE_BITCODE'] = 'NO'
      end
    end
    if target.name.include?("Watch") || target.name.include?("watchOS")
      isWatch = true
    end
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '5.0'
      if config.name == 'Release' && !isWatch
        config.build_settings['ARCHS'] = 'arm64'
      end
    end
  end
end