首页 文章

在Xcode中构建用于Unity Demo的Google Cardboard SDK的错误

提问于
浏览
1

我正在尝试在Xcode中构建Google Cardboard SDK for Unity的DemoScene来运行它我的iPhone 6 Plus .

但它不起作用,虽然我可以使它在Unity和Android上运行 .

有没人试过呢?任何建议都非常受欢迎 .

错误信息如下 .

Undefined symbols for architecture armv7:
  "_InitFromUnity", referenced from:
      RegisterMonoModules() in RegisterMonoModules.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

3 回答

  • 0

    Google Cardboard SDK(Unity插件)仅适用于Android .

  • 1

    虽然Google Cardboard Unity插件确实不支持iOS,但它仍然不应该无法编译 . 这个问题似乎是对程序包中实际不包含的DLL的一些迷失参考(可能是谷歌团队内部使用的?) .

    我有一个项目,我想要Android的Cardboard插件,但也需要支持其他平台(使用其他输入模式),我破解了这样的解决方案:

    在Cardboard / Scripts / Cardboard.cs中,更改这组行...

    #if UNITY_IPHONE && !UNITY_EDITOR
      [DllImport("__Internal")]
    #else
      [DllImport("RenderingPlugin")]
    #endif
      private static extern void InitFromUnity(int textureID);
    

    ......对......

    #if UNITY_IPHONE && !UNITY_EDITOR
        private static void InitFromUnity(int textureID) {}
    #else
        [DllImport("RenderingPlugin")]
        private static extern void InitFromUnity(int textureID);
    #endif
    

    最终结果应该是一个虚函数,它不连接到DLL而不是连接到不存在的DLL的外部函数 . Cardboard插件仍然无法在iOS上运行,但您可以再次进行COMPILE,而无需将其从项目中完全删除 .

    也许将来谷歌可以纠正这个问题(不确定报告它的适当位置是......?)甚至可以添加iOS支持(如果我们很幸运) .

    干杯 .

  • 2

    只需使用Durovis Unity插件即可 . 它与iOS完美搭配 . 只需要注释掉两行引用某些Android特定内容的行 . 只需构建一个运行,您将看到哪些行您要注释掉 .

    你可以在这里得到它:http://www.durovis.com/sdk.html

相关问题