import SnapKit
と書いて
No such module 'SnapKit'
と怒られてしまった人のためのメモです
2017年9月26日時点で成功した方法を記述しています。
■cocoapods とは
ライブラリを管理するためのライブラリです。
cocoapods 導入した時に生成される Podfile の中身を
編集して、 pod install のコマンドを打つだけで
設定したライブラリを自動的に導入してくれます。
2017年10月時点では、iOSアプリ開発では
一般的に使われているツールのようです。
■cocoapodsのインストール
以下を実行して、Rubyを最新にします
$ sudo gem update --system
RubyGems system software updated
以下を実行して、インストールをします
$ sudo gem install -n /usr/local/bin cocoapods
$ pod setup
CocoaPods 1.4.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.4.0.beta.1
アプリ名/Podfileを以下のように編集します “` # Uncomment the next line to define a global platform for your project # platform :ios, ‘9.0’
target ‘Omikuji’ do
# Comment the next line if you’re not using Swift and don’t want to use dynamic frameworks
use_frameworks!
# ここにimportで使うライブラリを記述します
pod 'SnapKit', '>=3.2.0'
# Pods for Omikuji
target 'OmikujiTests' do
inherit! :search_paths
# Pods for testing
end
target 'OmikujiUITests' do
inherit! :search_paths
# Pods for testing
end
end
```
※ このファイルを編集する際は(このファイルに限りませんが)、
mac OS標準のテキストエディットを使わないようにしてください。
スマート引用符の自動置換により、無効な文字が混入される可能性が高くなります。
混入された場合は、大体以下のようなエラーメッセージが出ます
[!] Smart quotes were detected and ignored in your Podfile. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
[!] Please close any current Xcode sessions and use `Omikuji.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
[!] Automatically assigning platform ios with version 10.3 on target Omikuji because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
コメント