11
Go to list of users who liked
13
More than 5 years have passed since last update.
Unity5でwebViewを表示させようとしてハマったので、メモ。
iosシミュレータで表示させるまでやりました。
androidは未確認です。
gree社製プラグイン
コチラから落としてきます。
Unity5ではエラーが出る
Runしようとすると下記エラーが出るので対応します。
"Couldn't open Assets/Plugins/WebView.bundle/Contents/MacOS/WebView, error: dlopen(Assets/Plugins/WebView.bundle/Contents/MacOS/WebView, 2): no suitable image found. Did find:Assets/Plugins/WebView.bundle/Contents/MacOS/WebView: mach-o, but wrong architecture"
こちらのやり方で解決しました。
プラグインのWebView.bundleというファイルを生成し直します。
- plugins/Mac/WebView.xcodeproj をひらく
- Build Setting -> 「Architectures」 -> 「Architectures」を64bit architectureに変更する

- 「Product」 -> 「Archive」からWebView.bundleを生成する

- XCodeのOrganizerが立ち上がるので、「Export」からファイルを書き出します
- それを"Plugins/WebView.bundle"に上書きます
ソースコード
こちらのコードを拝借させていただきました。
iosビルドするとXCodeでエラーが出る
'retain' is unavailable: not available in automatic reference counting mode
arc周りでエラーがでてるっぽいです。
こちらのやり方で解決しました。
Build PhasesのCompileSourcesでWebView.mmのCompiler Flagsに"-fno-objc-arc"を追加
この方法だと、Unity上ではwebviewは見れないです。
ビルドして実機orシミュレーターで確認するしかなさそうです。
- シミュレーターで確認

Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme