Search Unity

Unity 5.2.2f1 Embed in iOS with extern DllImport("__Internal")] methods fails to compile.

Discussion in 'iOS and tvOS' started by aventurella, Oct 29, 2015.

  1. aventurella

    aventurella

    Joined:
    Sep 10, 2015
    Posts:
    5
    I get the following error:

    undefined symbols for architecture arm64:
    "_g_PInvokeWrapperPointers", referenced from:
    g_CodeRegistration in Il2CppCodeRegistration.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)


    I'm trying to call into Objective-C from Unity, I have the following defined in my MonoBehavior

    #if UNITY_IPHONE && !UNITY_EDITOR
    [DllImport("__Internal")]
    private extern static void ShowNativeDatePicker();
    #else
    private static void ShowNativeDatePicker() { Debug.Log ("STUB FOR FUTURE");}
    #endif

    Trying to figure out what I am missing here. Do I need to link anything? Il2CppCodeRegistration.cpp is present and being compiled into the project. I have cleaned my derived data, and cleaned the project and tried to rebuild.

    Now it might be that I had my initial project from unity built, then did some work, and went back to test the calls in objective-c after a bit. However, I had already imported the files into the Xcode project and I have not added any additional files after re-building the unity project with my new method added:

    [DllImport("__Internal")]
    private extern static void ShowNativeDatePicker();


     
  2. aventurella

    aventurella

    Joined:
    Sep 10, 2015
    Posts:
    5
    Yup, that did the trick.. After rebuilding the app from unity:

    1. I just brought the unity/build/path/Classes/ folder back in
    2. recompiled and everything works