3
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 5 years have passed since last update.

Unity - iPhone + VRで躓いた時に読み返す備忘録

Last updated at Posted at 2019-03-15

概要

UnityプロジェクトをiOS向けにビルドして、実機デバックをする時に躓いた事をメモしておきます。

あくまで備忘録なので、まとめるつもりはありません。

Automatically manage signingができない

Unityでビルドをして作られたXcodeプロジェクトは、Automatically manage signingにチェックが入っていません。

これはとても不便なので、チェックを入れましたが、上手くいませんでした。

解決方法としては、
「TARGETS」→「Unity-iPhone」→「Build Settings」→「Code Signing Identity」を全て「iOS Developer」にするでした。

毎回変えないといけないのが面倒くさいですね。

ちなみにそれでも怒られる方は、「TARGETS」→「Unity-iPhone」→「Signing」のTeamをいろいろと変えてみましょう。

あとはUnity側のTeam IDも設定したほうが良いっぽいです。ここは検証できてません。

Linker command failedがGoogleVRによって出る

どうもGoogleVRをUnityに追加すると、Linker command failedが出てしまいました。

最初に出たのはこれ

Undefined symbols for architecture arm64:
  "_gvr_set_default_viewer_profile", referenced from:
      _GvrCardboardHelpers_gvr_set_default_viewer_profile_m07028866FB149E1AC5CECE15964D0B9EE8A6CA97 in Bulk_Assembly-CSharp_0.o
     (maybe you meant: _GvrCardboardHelpers_gvr_set_default_viewer_profile_m07028866FB149E1AC5CECE15964D0B9EE8A6CA97)
  "_gvr_reset_tracking", referenced from:
      _GvrCardboardHelpers_gvr_reset_tracking_m787C501547F2AF315F6CB1F8DDA59F7FCD9032AF in Bulk_Assembly-CSharp_0.o
     (maybe you meant: _GvrCardboardHelpers_gvr_reset_tracking_m787C501547F2AF315F6CB1F8DDA59F7FCD9032AF)
  "_gvr_get_time_point_now", referenced from:
      _AndroidNativeKeyboardProvider_gvr_get_time_point_now_m06805997F8027305F0BD844EDD089F6EAC7536EB in Bulk_Assembly-CSharp_0.o
     (maybe you meant: _AndroidNativeKeyboardProvider_gvr_get_time_point_now_m06805997F8027305F0BD844EDD089F6EAC7536EB)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

それでググっていたら「なんか全部消して必要なのだけ足したら、ビルドできたで」

っていう英語の回答を見つけました。

エラー文を見ると「Android」っていうどう見てもAndroidデバイス用のファイルが原因っぽいので、「Android」と名前のつくファイルを全て「Unity」→「Asset」内から削除しました。

そして次に出たのがこれ。

Undefined symbols for architecture arm64:
  "_gvr_set_default_viewer_profile", referenced from:
      _GvrCardboardHelpers_gvr_set_default_viewer_profile_m07028866FB149E1AC5CECE15964D0B9EE8A6CA97 in Bulk_Assembly-CSharp_0.o
     (maybe you meant: _GvrCardboardHelpers_gvr_set_default_viewer_profile_m07028866FB149E1AC5CECE15964D0B9EE8A6CA97)
  "_gvr_reset_tracking", referenced from:
      _GvrCardboardHelpers_gvr_reset_tracking_m787C501547F2AF315F6CB1F8DDA59F7FCD9032AF in Bulk_Assembly-CSharp_0.o
     (maybe you meant: _GvrCardboardHelpers_gvr_reset_tracking_m787C501547F2AF315F6CB1F8DDA59F7FCD9032AF)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ということで今度は、「GvrCardboard」と名前のつくファイルを削除しました。(私のときは1つでした)

そして、それでもエラーが出てしまい、どうやら「Unity」→「GoogleVR」→「Demo」内にGvrCardboardを呼び出しているソースが入っていそうなので、「Demo」フォルダを全削除しました。

work-space読んでないじゃん

ここまできて、

ld: warning: directory not found for option '-L/Users/mikito_ogino/Library/Developer/Xcode/DerivedData/Unity-iPhone-aabfelpnlqgprscecknnsxbowmyc/Build/Products/Debug-iphoneos/GTMSessionFetcher'
ld: warning: directory not found for option '-L/Users/mikito_ogino/Library/Developer/Xcode/DerivedData/Unity-iPhone-aabfelpnlqgprscecknnsxbowmyc/Build/Products/Debug-iphoneos/GoogleToolboxForMac'
ld: library not found for -lGTMSessionFetcher
clang: error: linker command failed with exit code 1 (use -v to see invocation)

というエラーが出たので調べたところ、そもそも.xcworkspaceと.xcodeprojが生成されていた事に気が付きました。

workspace最初から読み込んでおけば、上のエラーも出なかったかもしれませんね。

何はともあれ、ここまでで、ようやくUnity-iPhone-VRという環境が完成しました。

Automatically manage signingにチェックが入らない

UnityでビルドしたXcodeプロジェクトを開いても、Automatically manage signingにチェックが入らないという現象が起きました。

Unity側のPlayer Settingsでは「Automatically Sign」にチェックが入っており、「Signing Team ID」も設定されていました。

おかしいなと思い、「Automatically Sign」のチェックを外し、もう一回チェックを入れるという作業をしたら、Xcode上でもAutomatically manage signingにチェックが入るようになりました。

3
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
3
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?