【问题标题】:How to Link a framework required by a macOS bundle when building an xcode project requiring this bundle如何在构建需要此包的 xcode 项目时链接 macOS 包所需的框架
【发布时间】:2021-12-21 03:02:28
【问题描述】:

我有一个 macOSX 捆绑项目 B,它需要 GameKit 框架。我可以将它编译成一个包,创建 B.bundle。

我把这个 B.bundle 放在需要这个包才能工作的项目 A 中。当我尝试构建项目 A 时,出现链接错误:

"__OBJC_CLASS_$_GKAccessPoint", referenced from:
obj-class-ref in ....
 "__OBJC_CLASS_$_GKLocalPlayer", referenced from:
obj-class-ref in ....

ld: symbol(s) not found for architecture arm64

GKAccessPoint 和 GKLocalPlayer 是我的 bundle 项目使用的两个类。看起来它根本找不到类(我尝试为其他架构构建,它也失败了,但架构名称发生了变化)。

我真的不知道如何使链接工作。这是我的项目 B 中的设置:

这里是我的项目 A 中的设置:

谢谢!

【问题讨论】:

    标签: xcode macos unity3d linker bundle


    【解决方案1】:

    好的,折腾了一天,终于知道是什么问题了。

    我正在使用 unity 生成主项目,而原生 GameKitNativebundle.bundle 以及 GameKitNativebundle.mm 文件位于项目内的 Assets 文件夹下。

    问题是我已将 .mm 文件勾选为包含在独立版本中。所以xcode试图直接编译这个.mm文件并试图链接它,失败了。

    取消勾选 .mm 文件中的独立复选框并从 unity 重建 xcode 项目,再次创建项目链接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-19
      • 2022-01-23
      • 1970-01-01
      • 2021-01-17
      • 1970-01-01
      • 2021-11-07
      • 2014-10-21
      相关资源
      最近更新 更多