LoginSignup
2
0

More than 3 years have passed since last update.

ビルドエラー:Exception: Calling TargetGuidByName with name='Unity-iPhone' is deprecated.

Last updated at Posted at 2021-02-02

環境

Unity 2019.4.19f1

該当のコード


                var target = proj.TargetGuidByName("Unity-iPhone");
                proj.AddFrameworkToProject(target, "WebKit.framework", false);

発生したエラー

Exception: Calling TargetGuidByName with name='Unity-iPhone' is deprecated. There are two targets now, call GetUnityMainTargetGuid() - for app or GetUnityFrameworkTargetGuid() - for source/plugins to get Guid instead.

ただのDeprecatedなのでビルドは成功するけど、上記メッセージを残して終了する。
理由はメッセージの通り、There are two targets nowであるからだ。

で、たぶんこのままXcodeでビルドしようとするとだいたい失敗する。

どう修正すべきかもメッセージ通りで、アプリ用ならGetUnityMainTargetGuid(), プラグイン用ならGetUnityFrameworkTargetGuid()を呼ぶようにすればよい。

解決


                var target = proj.GetUnityFrameworkTargetGuid();
                proj.AddFrameworkToProject(target, "WebKit.framework", false);

結論

エラーメッセージを読め

2
0
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
2
0