简体   繁体   中英

ExecutionEngineException: Attempting to JIT compile method

public class StaticDataContainer<T> where T : IStaticData { 
protected static Dictionary<int, T> data;


public static void init(string jsonString){
    //It work fine in Unity,But in Xcode iOS,it will show an error below:
    //ExecutionEngineException: Attempting to JIT compile method
    //'System.Collections.Generic.Dictionary`2<int, AD>:.ctor ()' 
    //while running with --aot-only.
    data = new Dictionary<int, T> ();

I refer to: http://answers.unity3d.com/questions/250803/executionengineexception-attempting-to-jit-compile.html

Your application makes use of some generic type that was missed during AOT compile. And solution is:The problem can usually be fixed by including a "dummy" class that references the missing types.

But I dont' know what dummy class is. How can I solve it?

Here's how I do it. I create a file with name AOTDummy.cs in a project with following structure (adapted for your problem):

public static class AOTDummy
{
    public static void Dummy()
    {
        System.Collections.Generic.Dictionary<int, AD> dummy01;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM