团结 Xcode 项目 PlayerSettings_GetBundleIdentifier

Unity Xcode Project PlayerSettings_GetBundleIdentifier

我目前正在尝试从 Unity 构建一个 iOS 应用程序,但在这 4 个错误中保持 运行:

Undefined symbols for architecture arm64:
"_utilityBundleIdentifier", referenced from:
      _NativeBinding_utilityBundleIdentifier_m3566456099 in Bulk_Assembly-CSharp-firstpass_4.o
      _NativeBinding_GetBundleIdentifier_m2869188113 in Bulk_Assembly-CSharp-firstpass_4.o
      _PlayerSettings_GetBundleIdentifier_m1189967083 in Bulk_Assembly-CSharp-firstpass_4.o
     (maybe you meant: _NativeBinding_utilityBundleIdentifier_m3566456099)
  "_utilityBundleVersion", referenced from:
      _NativeBinding_utilityBundleVersion_m3211654534 in Bulk_Assembly-CSharp-firstpass_4.o
      _NativeBinding_GetBundleVersion_m3758909934 in Bulk_Assembly-CSharp-firstpass_4.o
      _PlayerSettings_GetBundleVersion_m1248687572 in Bulk_Assembly-CSharp-firstpass_4.o
     (maybe you meant: _NativeBinding_utilityBundleVersion_m3211654534)
  "_debugProLogMessage", referenced from:
      _NativeBinding_debugProLogMessage_m135661794 in Bulk_Assembly-CSharp-firstpass_2.o
     (maybe you meant: _NativeBinding_debugProLogMessage_m135661794)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

退出代码 1 - 架构 arm64 的未定义符号通常指向一个尚未包含的框架,但这些引用指向 PlayerSettings_GetBundleIdentifier,据我所知,Unity 属性 .

此外,当包标识符、版本和构建在 XCode 中设置时:

这些是其他链接器标志

这个错误是什么意思?我是否忘记包含一个框架,是哪个框架还是 Unity 或 XCode 设置有问题?

出现此问题是因为 VoxelBusters 中引用的 3 种方法在随插件提供的任何 .h 和 .m 文件中都不存在。使用 __Internal DLL 将您 link 方法导入 Objective-C 代码。

[DllImport("__Internal")]
private static extern string utilityBundleVersion ();
[DllImport("__Internal")]
private static extern string utilityBundleIdentifier ();
[DllImport("__Internal")]
public static extern void debugProLogMessage (string _message, eConsoleLogType _type, string _stackTrace);

XCode 项目中不存在。当我将这些方法添加到 Unity 的 AppDelegate.h & AppDelegate.m 时,错误消失了,现在我可以继续工作了。