juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.12k stars 514 forks source link

[Simulator] error build: Framework not found UnityFramework #770

Closed polaris7765 closed 1 year ago

polaris7765 commented 1 year ago

Describe the bug when run iOS version In a simulator will see this error. 1 2

To Reproduce Steps to reproduce the behavior:

  1. export iOS unityLibrary step by step
  2. in Xcode click .xcworkspace file
  3. set Unity_iphone/Data as UnityFramework library
  4. start a simulator and clicked run then see this error

Xcode : 14.01 Flutter: 3.7.3 Unity : 2021.3.10f1

timbotimbo commented 1 year ago

This is why the readme notes that emulators aren't supported.

You can instead run it on Apple Silicon (M1/M2) macs with the Mac (Designed for iPhone) target. (Unity Target SDK set to Device SDK).

Workaround

There is a workaround for simulators that requires some fiddling:

Now you might get it running on an emulator, but it isn't ideal and guaranteed. You will of course need to reverse all this to run it on a real iphone again.

polaris7765 commented 1 year ago

This is why the readme notes that emulators aren't supported.

You can instead run it on Apple Silicon (M1/M2) macs with the Mac (Designed for iPhone) target. (Unity Target SDK set to Device SDK).

Workaround

There is a workaround for simulators that requires some fiddling:

  • Set Target SDK in the unity player settings to Simulator SDK. (this builds in x86_64 mode)
  • Remove all AR and XR packages in the unity package manager. (iOS emulators can't handle ARKit) If your app uses AR, you are out of luck and can stop reading here.
  • In Xcode you need to edit the valid architecture for Runner and Unity-iphone. Only x86_64 should be enabled, no arm version can be allowed. (you might need to do this for some pods as well, I don't remember)
  • On an Apple Silicon mac, this should run the emulator in Rosetta mode.

Now you might get it running on an emulator, but it isn't ideal and guaranteed. You will of course need to reverse all this to run it on a real iphone again.

thanks for your help, this is very useful for me, I try to run mac and export .ipa installed on real iPhone. both of them are working well. and follow this picture also can help alot when you have some export ipa problem. 1 from:https://github.com/juicycleff/flutter-unity-view-widget/issues/83