頭のメモリが少ない

プログラミングと日々の生活

Xcode12でビルドできるようにするまで

Xcode12でビルドできるようにするまで

  • 実機のビルドだけであれば特に下記の内容対応する必要がないが、エミュレータを指定してビルドを行うとコケる。

使用したXcode

Xcode Version 12.0 (12A7209)

対応内容

  • Podfileの修正
  • Carthageビルド用のスクリプト追加
  • Build Settingsの修正

Podfileの修正

  • Podfileに下記を追加
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
    end
  end
end

ref: https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios

Carthageビルド用のスクリプト追加

$ curl https://gist.githubusercontent.com/skymobilebuilds/61f4a95bd62a3db36b52719aeab7e0d5/raw/4ba422e5f3a5e7e37cdcb1e232058c5431fc59fc/carthage-xc12.sh -o wcarthage && chmod +x wcarthage
$ ./wcarthage bootstrap --platform iOS --cache-builds --no-use-binaries

ref: https://gist.github.com/skymobilebuilds/61f4a95bd62a3db36b52719aeab7e0d5

Build Settingsの修正

  • Xcode -> Target Project -> Build Setting -> Excluded Architectures > "arm64"
  • Xcode -> Pod Target -> Build Setting -> Excluded Architectures > "arm64" f:id:chick-developer:20200924154755p:plain

  • Xcode -> Target Project -> Build Setting -> VALID_ARCHS > "x86_64"を追加 f:id:chick-developer:20200924154526p:plain

https://github.com/CocoaPods/CocoaPods/issues/10059#issuecomment-695876995