IOS .dylib on Vision Pro

Hi,

I am trying to bring an existing Unity app to vision pro, and am trying to make all of the librairies compatible (the project loads native libs at runtime).
For some of them, there is an arm64 IOS .framework file that seems to build and be found easily in the device, but for one of them I only got a .dylib.

When building on xcode, it tells me it can’t find it. So I added it to the lib search path in build settings, and it built. But on the device, it still can’t seem to find the .dylib :

Library not loaded: ./libpdfium.dylib
  Referenced from: <59B1ACCC-FFFD-3448-B03D-69AE95604C77> /private/var/containers/Bundle/Application/0606D884-CB09-44CA-8E4F-4A309D2E7053/[...].app/Frameworks/UnityFramework.framework/UnityFramework
  Reason: tried: '/usr/lib/system/introspection/libpdfium.dylib' (no such file, not in dyld cache), './libpdfium.dylib' (no such file), '/usr/lib/system/introspection/libpdfium.dylib' (no such file, not in dyld cache), '//libpdfium.dylib' (no such file)

I am not used to Apple environment, is there a way to correctly reference this .dylib (not talking about compatibility here, just the first “lib found” step) ?

Thanks.
This post is also on the apple developers forums.

Hi there! Thanks for reaching out, and sorry to hear that you’re having trouble.

I’ll need a little more information on how your project is set up to answer this. As always, if you submit a bug and include a zip of your project (which is automatically included if you go to Help > Report a bug...), it’s much easier for us to make sense of what’s going on.

Short of that, is the framework with this libpdfium.dylib file included in your project, or does it come from some package manager like cocoapods? Do you have a visionOS build of the library? Although they are similar, visionOS and iOS don’t actually use the same SDK, and you probably won’t be able to load a library built for iOS in an app built for visionOS. The iOS compatibility on visionOS is only for entire apps built for iOS.

If you do have a visionOS version of the library, do you have visionOS selected as a build platform for it in the plugin import settings? You can see these settings in the Inspector when the .framework file is selected in Unity. I’m not super familiar with .framework plugins (I usually work with statically-linked .a files) but I don’t think you can use the same one for visionOS and iOS.

Let us know if you’re able to submit a bug, and if not please provide answers to my questions above.

Thanks again for posting, and good luck!

Hi,
I can’t provide the project unfortunately. The libs are manually included to the project (files are somewhere in the Assets folders) for portability.

The way it worked on the Android version is : one netstandard DLL that uses native libs from loose .so libs in the project.

So what I did is importing the IOS versions of the .so. None of them was ported to VisionOS, so I’m expecting them not to work as their made for IOS. But the error I get seems to indicate that it can’t even find / load the .framework or .dylib, which might get me into trouble later on if I find some compatible lib for VisionOS.

Thanks

I think the .framework has a .dylib per platform, so when it’s saying it can’t find it, it’s ignoring the iOS one. What you have in the inspector there is correct, but even if it was able to locate the iOS library file I’m pretty sure you would have issues trying to load it. You’ll need to rebuild these plugins with a visionOS build.

Alright, thanks.