Unity3d IOS il2cpp Migration Astarpath Josnfx Error

Source: Internet
Author: User

A number of issues have arisen during the migration of the company's Unity3d game from Mono to iOS 64.

There is a sense of accomplishment when you see Xcode prompting build success, but the nightmare is just beginning.

Because of the il2cpp or the way to convert C # code to C + + is too rough, not only in the build phase will be a lot of errors, during the run-time abnormal crashes are countless.


After solving the bug of the build phase, I finally ran the game yesterday, but after entering the main city, it was black screen, what fuck!

But fortunately in Xcode there is an unusual burst.

Method not found: ' Default constructor not Found...ctor () of System.ComponentModel.Int64Converter '. At System.Activator.CreateInstance (System.Type Type, system.object[] args) [0x00000] in <filename unknown>:0 at Sy Stem. ComponentModel.TypeDescriptor.GetConverter (System.Type Type) [0x00000] in <filename unknown>:0 at Pathfinding.Serialization.JsonFx.TypeCoercionUtility.CoerceType (System.Type TargetType, System.Object value) [ 0X00000] in <filename unknown>:0 at Pathfinding.Serialization.JsonFx.JsonReader.ReadNumber (System.Type Expectedtype) [0x00000] in <filename unknown>:0 at Pathfinding.Serialization.JsonFx.JsonReader.Read ( System.Type Expectedtype, Boolean typeishint) [0x00000] in <filename unknown>:0 at Pathfinding.Serialization.JsonFx.JsonReader.PopulateObject (system.object& result, System.Type ObjectType, System.Collections.Generic.Dictionary ' 2 membermap, System.Type genericdictionarytype) [0x00000] in <filename  unknown>:0

Literally, there's no default constructor?

What the heck.

But according to the anomaly, the anomaly points to the system function ...


There is no way to just Google.

In the Unity official forum finally saw a developer response to this problem, the suspicion is because unity's code clipping optimization, cut off this part of the code support!

The official technical support replied that it was unlikely to be the result of this optimization, but it also gave a solution.

For classes that prompt for exceptions, create a script that uses new in the script to invoke the constructor of the class so that it is not optimized to crop.


I actually doubt this is a stripping issue. It's more likely related to an AOT limitation. Il2cpp can only construct and instance of a type at runtime, that it knows on at compile time. System.Activator.CreateInstance to succeed, Il2cpp needs to has previously generated code for the System .  Type passed as the first argument to Createinstance.you is able to work around this issue by declaring an unused field of type System.ComponentModel.Int64Converter in a class that won't be stripped. A monobehaviour in one of your scripts is likely a good candidate. Maybe try something like this:

    Class Aottypes:monobehaviour    {        private static System.ComponentModel.Int64Converter _unused = new System.ComponentModel.Int64Converter ();    }

And then what about all the classes you need to use?

private static System.ComponentModel.Int64Converter _unused = new System.ComponentModel.Int64Converter ();    private static System.ComponentModel.DecimalConverter _unused2 = new System.ComponentModel.DecimalConverter ();    private static System.ComponentModel.ByteConverter _unused3 = new System.ComponentModel.ByteConverter ();    private static System.ComponentModel.CollectionConverter _unused4 = new System.ComponentModel.CollectionConverter ();    private static System.ComponentModel.CharConverter _unused5 = new System.ComponentModel.CharConverter ();    private static System.ComponentModel.SByteConverter _unused6 = new System.ComponentModel.SByteConverter ();    private static System.ComponentModel.Int16Converter _unused7 = new System.ComponentModel.Int16Converter ();    private static System.ComponentModel.UInt16Converter _unused8 = new System.ComponentModel.UInt16Converter ();   private static System.ComponentModel.Int32Converter _unused9 = new System.ComponentModel.Int32Converter (); private static System.ComponentModel.UInt32Converter _unused10 = new System.ComponentModel.UInt32Converter ();    private static System.ComponentModel.Int64Converter _unused11 = new System.ComponentModel.Int64Converter ();    private static System.ComponentModel.UInt64Converter _unused12 = new System.ComponentModel.UInt64Converter ();    private static System.ComponentModel.DoubleConverter _unused13 = new System.ComponentModel.DoubleConverter ();    private static System.ComponentModel.SingleConverter _unused14 = new System.ComponentModel.SingleConverter ();    private static System.ComponentModel.BooleanConverter _unused15 = new System.ComponentModel.BooleanConverter ();    private static System.ComponentModel.StringConverter _unused16 = new System.ComponentModel.StringConverter ();    private static System.ComponentModel.DateTimeConverter _unused17 = new System.ComponentModel.DateTimeConverter (); private static System.ComponentModel.EnumConverter _unused18 = new System.ComponentModel.EnUmconverter (typeof (<any your enum>)); private static System.ComponentModel.TimeSpanConverter _unused19 = new System.ComponentModel.TimeSpanConverter ();

This prevents the code from being cropped.


The game runs successfully.

Unity3d IOS il2cpp Migration Astarpath Josnfx Error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.