我目前正在尝试在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

最佳答案

我通过在Unity项目中更新Vuforia来解决了该问题,尽管在更新之前我没有删除Plugins文件夹中的Vuforia文件。我以前尝试对Vuforia进行适当的更新,但失败了。

步骤如下:
1-删除资产/ Vuforia

2-将VuforiaCamera.cs(资产/脚本/ 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");
        }
    }
}

关于ios - Unity Vuforia Xcode构建错误:“体系结构arm64的 undefined symbol ”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42221422/

10-10 20:42