ssannandeji / Zenject-2019

Dependency Injection Framework for Unity3D
MIT License
2.53k stars 363 forks source link

Runtime iOS error #606

Open Druzhino opened 5 years ago

Druzhino commented 5 years ago

Hey. I integrate zenject into my project, and I have a problem. Everything works fine in the editor, but when you start the build on the device, even the first scene does not start, and I get the following error (from xcode): MissingMethodException: Constructor on type 'Zenject.ZenjectManagersInstaller' not found. at Zenject.Internal.ReflectionInfoTypeInfoConverter+<>c__DisplayClass4_0.b__0 (System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0 at Zenject.ZenFa at Zenject.DiContainer.InstantiateInternal (System.Type concreteType, System.Boolean autoInject, System.Collections.Generic.List1[T] extraArgs, Zenject.InjectC at Zenject.DiContainer.InstantiateExplicit (System.Type concreteType, System.Boolean autoInject, System.Collections.Generic.List1[T] extraArgs, Zenject at Zenject.DiContainer.InstantiateExplicit (System.Type concreteType, System.Collections.Generic.List1[T] extraArgs) [0x00000] in <000000000000 at Zenject.DiContainer.Instantiate (System.Type concreteType, System.Collections.Generic.IEnumerable1[T] extraArgs) [0x00000] in <00000000000000000000000000000000>:0 at Zenject.DiContainer.Instantiate[T] (System.Collections at Zenject.DiContainer.Instantiate[T] () [0x00000] in <00000000000000000000000000000000>:0 at Zenject.Installer1[TDerived].Install (Zenject.DiContainer containe at Zenject.ProjectContext.InstallBindings (System.Collections.Generic.List1[T] injectableMonoBehaviours) [0x00000] in <00000000000000000000000000000000>:0 at Zenject.ProjectContext.Initialize () at Zenject.ProjectContext.InstantiateAndInitialize () [0x00000] in <00000000000000000000000000000000>:0 at Zenject.ProjectContext.get_Instance () [0x00000] in <00000000000000000000000000000000>:0 at Zenject.SceneContext.RunInternal () [0x00000] in <00000000000000000000000000000000>:0 at Zenject.RunnableContext.Run () [0x00000] in <00000000000000000000000000000000>:0 at Zenject.RunnableContext.Initialize () [0x00000] in <00000000000000000 at Zenject.SceneContext.Awake () [0x00000] in <00000000000000000000000000000000>:0 Rethrow as ZenjectException: Error occurred while instantiating object with type 'ZenjectManagersInstaller' at Zenject.DiContainer.InstantiateInternal (System.Type concreteType, System.Boolean autoInject, System.Collections.Generic.List1[T] extraArgs, Zenject.InjectContext context, System.Object concreteIdentifier) [0x00000] in <00000000000000000000000000000000>:0 at Zenject.DiContainer.InstantiateExplicit (System.Type concreteType, System.Boolean autoInject, System.Collections.Generic.List1[T] extraArgs, Zenject.InjectContext context, System.Object concreteIdentifier) [0x00000] in <00000000000000000000000000000000>:0 at Zenject.DiContaine at Zenject.DiContainer.Instantiate (System.Type concreteType, System.Collections.Generic.IEnumerable1[T] at Zenject.DiContainer.Instantiate[T] (System.Collections.Generic.IEnumerable1[T] extraArgs) [0x00000] in <00000000000000000000000000000000>:0 at Zenject.DiContainer.Instantiate[T] () [ at Zenject.Installer1[TDerived].Install (Zenject.DiContainer container) [0x00000] in <00000000000000000000000000000000>:0 at Zenject.ProjectContext.InstallBindings (System.Collections.Generic.List1 at Zenject.ProjectContext.Initialize () [0x00000] in <00000000000000000000000000000000>:0 at Zenject.ProjectContext.InstantiateAndInitialize () [0x00000] in <0000000000 at Zenject.ProjectContext.get_Instance () [0x00000] in <00000000000000000000000000000000>:0 at Zenject.SceneContext.RunInternal () [0x00000] in <00000000000000000000000000000000>:0 at Zenject.RunnableContext.Run () [0x at Zenject.RunnableContext.Initialize () [0x00000] in <00000000000000000000000000000000>:0 at Zenject.SceneContext.Awake () [0x00000] in <00000000000000000000000000000000>:0

Any idea how to fix this?

Druzhino commented 5 years ago

Okay, I found the reason. I build the project in unity 2018.3.5f1, with settings: Scripting Backend : IL2CPP, Strip Engine Code : medium. When I changed the parameter Strip Engine Code to Low, everything began to work well.

But in that case I get a large build size for iOS. Maybe there is a way to remove the trim code, which makes unity?

upd. I found this solution in the documentation. But I can't compile the right file link.xml to make it work. Will it be possible in the next version for everyone? (I use zenject 8.0.0) https://docs.unity3d.com/Manual/IL2CPP-BytecodeStripping.html