ARFoundation-based app not linking ARKit package correctly in Xcode?

I've set up a test app from scratch to try out the new ARFoundation packages for cross-platform AR on ARKit and ARCore. My code is very similar to Unity's sample project (see https://github.com/Unity-Technologies/arfoundation-samples/blob/master/Assets/Scripts/PlaceOnPlane.cs), and I've added the three relevant packages to my manifest.json:

{
  "dependencies": {
    "com.unity.xr.arkit": "1.0.0-preview.11",
    "com.unity.xr.arcore": "1.0.0-preview.16",
    "com.unity.xr.arfoundation": "1.0.0-preview.12"
  }
}

I can build an Xcode project for iOS, but when I try to build in Xcode I get this error:

clang: error: no such file or directory: '/Users/kenny/AR/Projects/itp-XR-example-unity/Packages/com.unity.xr.arkit/Runtime/iOS/UnityARKit.m'

Apparently Unity adds a .m file from the ARKit package into the Xcode project with a reference that links to a path inside my project's /Packages folder. However there is nothing in that folder apart from the manifest.json (which I think is correct, since the packages themselves are stored system-wide in a cache folder somewhere).

What's wrong here? Is Unity generating incorrect references for the Xcode project, or is some other piece of the puzzle missing? Thanks.

By the way, this is on Unity 2018.1.0f2 and Xcode 9.3.

After a little more digging it seems this only happens when I check "symlink Unity libraries" in the iOS build settings - which I usually do because it avoids almost a GB of Unity libraries being duplicated on disk for each iOS build. With symlinking turned off, it copies the .m file into the Xcode project folder and everything links correctly.

The behavior Unity shows when the symlink libraries option is enabled still seems like a bug to me, though - it should symlink to the location where the .m file is actually kept (in Unity's packages cache). Can someone from Unity confirm or otherwise address this?

[quote=“kennyd-itp”, post:3, topic: 705598]
The behavior Unity shows when the symlink libraries option is enabled still seems like a bug to me, though - it should symlink to the location where the .m file is actually kept (in Unity’s packages cache). Can someone from Unity confirm or otherwise address this?
[/quote]

Yes, it’s a bug in the way packages are handled. We’ve documented this as a known issue, though that’s easy to miss. Unity’s asset database reports the contents of the ARKit package as “Packages/com.unity.xr.arkit/”, but “Packages” is actually an alias that resolves to a cache folder elsewhere on your machine. This does not play nicely with the generated Xcode trampoline project if you check the “Symlink” option.

Short term, I’m going to add a build preprocess step that checks for this and tells you what’s wrong. Longer term, I hope we will be able to support this properly.

Thanks!

any update to this?

This error was fixed a long time ago. Be sure to use a recent Unity version and verified package versions.