MonoDevelop settings to fix “ran out of trampoline

2019-04-06 09:00发布

问题:

we are developing an iOS app. When we tested the app on PC, everything works well but when we ran it on a iPad/iPhone4 we frequently receive the "Ran out of Trampolines type 2" error message and the app crash. We have been spending the last few days trying to identify the cause/fix it and tried all the suggestions we have find on the net, we still have not made any progress. The only solution we have found are from the posts/webpages talking about the adjusting the trampoline settings with compiler settings like this: -aot "nrgctx-trampolines=4048" -aot "nimt-trampolines=4048" in monotouch. But we are using Unity3D to develop our app so we don't have this compiler option exposed to us. But I believe both Monotouch and Unity3D are based on the Mono framework so I'm guessing the same compiler settings can be applied to our unity3D project as well?

Does anyone know if this is correct? if yes, would anyone be able to give me some instructions on how to enable this option in our Unity3D project?

Thanks a lot in advance!

回答1:

The current Unity3D version supports AOT compiler command line options. Here is a solution for the problem: Unity Serializer, Mono and Trampolines!



回答2:

Trampolines would require some kind of code generation, and iOS forbids code generation on the fly.

But it's possible that I'm wrong, and trampolines can be prebuilt, for known calls. If such is the case, then please go to your Unity folder (Mac OS X paths here), and check these two shell scripts:

/Applications/Unity/Unity.app/Contents/Frameworks/Mono/bin/build /Applications/Unity/Unity.app/Contents/Frameworks/Mono/bin/xbuild

They should be calling ./xbuild.exe. Though they might be others, please do a grep on them:

/Applications/Unity/Unity.app/Contents/Frameworks/Mono/bin $ grep -ri '.exe \"$@\"' .

Better off, I think there was "stackOverflow" unity based group, not sure about it's name though.