1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Xcode12にCarthageを導入する

Posted at

概要

Carthageを利用してライブラリを導入しようとしていたところ、carthage updateのところがどうしても通らず苦戦したのでアウトプットしておきます。

手順

Carthageのインストール

$ brew install carthage

homebrewの導入はこちらから

Cartfile作成

作成するアプリのディレクトリで以下のコマンドを実行

$ touch Cartfile

作成したCartfileを記述

$ vim Cartfile

今回はNuke、Rswift、KeychainAccessを導入しました。

github "mac-cain13/R.swift.Library"
github "kean/Nuke" ~> 9.0
github "kishikawakatsumi/KeychainAccess"

vimで編集&保存

carthage.sh作成

$ touch carthage.sh
$ vim carthage.sh

vimで編集して以下の内容を記述します。

#!/usr/bin/env bash

# carthage.sh
# Usage example: ./carthage.sh build --platform iOS

set -euo pipefail

xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT

# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig"
carthage "$@"

編集したcathage.shの権限を変更します。

$ chmod +x carthage.sh

ライブラリの更新

以下のコマンドを入力してCarthageのライブラリを更新します。

./carthage.sh update --use-submodules

ここから先はXcode11と同じ処理で追加できます。
参考記事

参考

https://qiita.com/zaburo/items/29fe23c1ceb6056109fd
https://qiita.com/kilalabu/items/aa37a24f289ce381154f
https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323
https://qiita.com/shisama/items/5f4c4fa768642aad9e06
https://qiita.com/tsuzuki817/items/8f6e2e0c2b3f9d19709712

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?