How to include dylibs in a package for iOS projects?

I have a PostProcessBuildAttribute that is responsible for modifying the Xcode project settings of my iOS project. I also have a dylib in my Assets/Runtime/Plugins/iOS directory. In my local development, the post processor adds the dylib to the xcode project using project.AddFile("path/to/lib.dylib", "Frameworks/" + dylib name, "PBXSourceTree.Absolute")

However, my ultimate goal is to include this dylib and accompanying post processor in a distributable package. When my test project imports the package (from tarball), the path to the dylib isn’t the same as in development – instead of Assets/Runtime/Plugins/iOS/..., it becomes Packages/<my_package>/Runtime/Plugins/iOS/.... I also can’t hardcode my dylib’s path using the package-version of the folder structure b/c that string is dependent on the package’s version.

What’s the best way to automatically detect the full path to the package, and switch to path to Assets if the code is not installed as a package?

@bszalapski did you find any solution for that? Were you able to properly publish the iOS project to the store with the dylib?

I ultimately went with a .framework, which Unity pulls in automatically (I think…?). Additionally, you can write the PostProcessor to use GUIDs instead of file paths, which gets around the packaging issue.

Another option that seemed to work as well was using a static .a instead of a .dylib – although it’s frustrating to have to statically load the library, chances are your native plugin isn’t that large, so isn’t too much of a memory hit.