Search Unity

_il2cpp_pinvoke_func() crash on iOS 8

Discussion in 'iOS and tvOS' started by van_ustwo, Mar 7, 2016.

  1. van_ustwo

    van_ustwo

    Joined:
    Jul 10, 2012
    Posts:
    82
    I'm getting this crash when running on iOS 8 devices. However it works on iOS 9.

    //Unity Script
    [DllImport("__Internal")]private static extern void Test_Init();

    //Xcode
    extern"C" {voidDEFAULT_CALL Test_Init();}


    extern"C" void Test_Init_m4100927712 (Il2CppObject * __this /* static, unused */, constMethodInfo* method)
    {
    typedefvoid (DEFAULT_CALL *PInvokeFunc) ();
    staticPInvokeFunc _il2cpp_pinvoke_func;
    if (!_il2cpp_pinvoke_func)
    {
    _il2cpp_pinvoke_func = (PInvokeFunc)Test_Init;
    if (_il2cpp_pinvoke_func == NULL)
    {
    IL2CPP_RAISE_MANAGED_EXCEPTION(il2cpp_codegen_get_not_supported_exception("Unable to find method for p/invoke: 'Test_Init'"));
    }
    }
    // Native function invocation
    _il2cpp_pinvoke_func(); //<-Crash
    }
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    @gamePig

    The call to _il2cpp_pinvoke_func is a calling to the native implementation of Test_Init. So there may be something in that code crashing. Can you debug into it to determine the cause?