Unity Vuforia Xcode构建错误:"架构arm64的未定义符号"

时间:2017-02-14 08:44:00

标签: ios xcode unity3d vuforia

我目前正在尝试在Xcode中构建一个项目(之前有效)。它是一个使用Vuforia插件的Unity项目,它完美地构建到Android。

在Xcode中构建时,我收到以下错误消息:

    Undefined symbols for architecture arm64:
  "_UnityRenderBufferMTLTexture", referenced from:
      PlatformiOS::setRenderBuffers(void*) in libVuforiaUnityPlayer.a(PlatformiOS.o)
  "_UnityCurrentMTLCommandEncoder", referenced from:
      PlatformiOS::setRenderBuffers(void*) in libVuforiaUnityPlayer.a(PlatformiOS.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我在项目中包含了Security.framework和SystemConfiguration.framework。

Unity 5.5.0f3; Vuforia SDK v5.5.9; XCode 8.2.1

1 个答案:

答案 0 :(得分:0)

我通过更新Unity项目中的Vuforia来解决问题,但是,在更新之前,我没有删除Plugins文件夹中的Vuforia文件。我之前尝试过正确更新Vuforia,但失败了。

步骤: 1 - 删除资产/ Vuforia

2 - 将VuforiaCamera.cs(Assets / Scripts / Vuforia)更新为以下代码

3 - 导入最新的Vuforia包

4 - 获利!

public class VuforiaCamera : MonoBehaviour
{
    private bool mVuforiaStarted = false;

    void Start()
    {
        VuforiaARController vuforia = VuforiaARController.Instance;

        if (vuforia != null)
            vuforia.RegisterVuforiaStartedCallback(StartAfterVuforia);
    }

    private void StartAfterVuforia()
    {
        mVuforiaStarted = true;
        SetAutofocus();
    }

    void OnApplicationPause(bool pause)
    {
        if (!pause)
        {
            // App resumed
            if (mVuforiaStarted)
            {
                // App resumed and vuforia already started
                // but lets start it again...
                SetAutofocus(); // This is done because some android devices lose the auto focus after resume
                // this was a bug in vuforia 4 and 5. I haven't checked 6, but the code is harmless anyway
            }
        }
    }

    private void SetAutofocus()
    {
        if (CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO))
        {
            Debug.Log("Autofocus set");
        }
        else
        {
            // never actually seen a device that doesn't support this, but just in case
            Debug.Log("this device doesn't support auto focus");
        }
    }
}