Closed torwa closed 3 years ago
It's a linker error, so it looks like you didn't link the Unity framework properly. It's indeed related to the target build on simulator. You should try to build your Unity app for the Simulator SDK and see if that works.
Thanks for your comment!
The Unity app is actually built for the Simulator SDK, as suggested here, otherwise the header file cannot even be found. And if I comment out everything about the FrameworkLibAPI
or API
, which corresponds to the message mechanism, the Unity part can be successfully initialized and displayed in a SwiftUI app on simulator. It seems that the original Unity framework can be correctly linked, but the message API itself will lead to the linker error.
Anyway, your entire code works well on real devices, that's good enough for me! Thanks for your great work.
Sorry for necroing old issue, but I believe, I've found a way to fix it for simulators. You would need to use NSClassFromString
to call FrameworkLibAPI methods. Read more details in this thread
The code just works fine for displaying Unity in a SwiftUI app, but has problem with your message API. If this line is added:
the linking process will fail, with error:
Are there any settings that I omitted or you forgot to mention?
Note: I'm trying to run it on simulator, so I chose "Simulator SDK" in Unity's project settings. Anything to do with that?