###経緯
今回はiOSプロジェクトを作成し、そのプロジェクト内でPlaygroundを使用してRealmSwiftの挙動を逐次確認してみよう、という目的で遭遇したエラーになります。
###前提・実現したいこと
####達成したいこと
PlayGround上でRealmを使用したい。
####各バージョン
2016年7月2日 14:00 現在
- Xcode: Version 7.3.1 (7D1014)
- pod: 1.0.1 (
pod --version
で確認)
Podfileは次のようにしています。
Podfile
1# Uncomment this line to define a global platform for your project 2# platform :ios, '9.0' 3 4target 'RealmSampleForiOS' do 5 # Comment this line if you're not using Swift and don't want to use dynamic frameworks 6 use_frameworks! 7 pod 'RealmSwift' 8 # Pods for RealmSampleForiOS 9 10 target 'RealmSampleForiOSTests' do 11 inherit! :search_paths 12 # Pods for testing 13 end 14 15end
pod install
を実行すると次のように出力されます。
Analyzing dependencies Downloading dependencies Installing Realm (1.0.1) Installing RealmSwift (1.0.1) Generating Pods project Integrating client project Sending stats Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
###発生している問題・エラーメッセージ
####手順
pod init
を実行後、上記のPodfileを作成。pod install
を実行.xcworkspace
を開く。- Xcode上でm「File > New File > iOS Source > Playground」を選択して、Playgroundを作成
- 作成したPlaygroundファイルに
import RealmSwift
を記述。 - 一旦「cmd + B」でビルド
上記の手順の結果、次のようなスクリーンショットのようなエラーが生じます。
ログを抜粋すると、エラーメッセージは次の通りです。
Playground execution failed: HelloRealmSwift.playground:1:8: error: no such module 'RealmSwift' import RealmSwift
####補足
念のため、ViewController.swift
にimport RealmSwift
を記述したところ、エラーは生じませんでした。次の画像はその時のスクリーンショットです。
###検索したこと
- 絶対動くSwift2.0でのRealmのインストールから扱いまで【2015-9/26日最新版】
- How to I import 3rd party frameworks into Xcode Playground? | StackOverflow
- RealmSwift no such module | Teratail
- Support using Realm in Swift Playgrounds #938
- RealmのXcode 7.1の対応状況について | StackOverflow 日本語版
他にも検索してますが、関係ありそうなところだけ・・・。
何卒、よろしくお願いします。
2016/7/5 11:38 追記
該当のコードを用意しました。
コミットのコメントに作業内容を書いています。また、Pods
は再現性の担保のために.gitignore
に記述しておりません。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/07/04 14:51 編集
退会済みユーザー
2016/07/05 02:03
2016/07/05 02:42
退会済みユーザー
2016/07/05 03:12
2016/07/05 03:28
退会済みユーザー
2016/07/05 04:19
2016/07/05 04:36