Xcode 10.2, Swift 5, Command compileSwift failed while build the program with Release Scheme

前端 未结 7 1326
我寻月下人不归
我寻月下人不归 2021-01-03 22:38

I\'m using Xcode 10.2, Swift 5.

With Debug scheme, no issue happens, but with Release scheme when I build or archive, it shows Command compileSwift failed with a non

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-03 23:10

    So I had same issue when updating my project to Swift 5. For some reason, Cocoapods (latest version, 1.6.1) set the SWIFT_VERSION of some pods to Swift 5 even if they're released as Swift 4, 4.1, 4.2 pods. So I had to add a post install script that set the correction version of swift like so

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        if target.name == 'CryptoSwift' || target.name == 'SwiftyBeaver'
          target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '4.2'
          end
        end
      end
    end
    

提交回复
热议问题