Search Unity

Sing in With Apple Unitypackage [Error in Android build]

Discussion in 'iOS and tvOS' started by Martin_Gonzalez, Feb 13, 2020.

  1. Martin_Gonzalez

    Martin_Gonzalez

    Joined:
    Mar 25, 2012
    Posts:
    361
    Hi there, when downloading the package Sign in With Apple from Asset Store

    https://assetstore.unity.com/packages/tools/sign-in-with-apple-154202

    There is an issue when building in Android, since we are developing multi platform apps.

    It's missing a #ifdef in the following part of the code that make Android build fail.

    Code (CSharp):
    1.         [DllImport("__Internal")]
    2.         private static extern void UnitySignInWithApple_Login(IntPtr callback);
    3.         [DllImport("__Internal")]
    4.         private static extern void UnitySignInWithApple_GetCredentialState(string userID, IntPtr callback);
    Here is the solution since I don't know where to do a pull request.

    Code (CSharp):
    1. #if (UNITY_IOS || UNITY_TVOS) && !UNITY_EDITOR
    2.         [DllImport("__Internal")]
    3.         private static extern void UnitySignInWithApple_Login(IntPtr callback);
    4.         [DllImport("__Internal")]
    5.         private static extern void UnitySignInWithApple_GetCredentialState(string userID, IntPtr callback);
    6. #endif
    And here is the exception that happen:

    Code (CSharp):
    1. il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: /android-ndk-r16b/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ @“/var/folders/85/1l1jzvbs6yz6ylmslck7x0p80000gp/T/tmpeByilm.tmp-o “/Library/il2cpp_android_armeabi-v7a/il2cpp_cache/linkresult_5D44B8A1974C4F6C552343067ADBAE5F/libil2cpp.so-shared -Wl,-soname,libil2cpp.so -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--gc-sections -Wl,--build-id --sysroot “/android-ndk-r16b/platforms/android-16/arch-arm” -gcc-toolchain “/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64" -target armv7-none-linux-androideabi -Wl,--wrap,sigaction -L “/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a” -lgnustl_static -llog -rdynamic -fuse-ld=gold
    2. /Temp/StagingArea/Il2Cpp/il2cppOutput/Bulk_Vendor_0.cpp:2225: error: undefined reference to ‘UnitySignInWithApple_Login’
    3. /Temp/StagingArea/Il2Cpp/il2cppOutput/Bulk_Vendor_0.cpp:2239: error: undefined reference to ‘UnitySignInWithApple_GetCredentialState’
    4. clang++: error: linker command failed with exit code 1 (use -v to see invocation)
     
  2. Masterfalcon

    Masterfalcon

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    364
    Hi Martin,

    Sorry about that. Your fix is absolutely right on. We'll get that included into the next package update. Thanks!
     
  3. Martin_Gonzalez

    Martin_Gonzalez

    Joined:
    Mar 25, 2012
    Posts:
    361
    Thanks! :D
     
  4. anflaoo

    anflaoo

    Joined:
    Mar 16, 2020
    Posts:
    4
    HI, @Masterfalcon, Have you ever thought of providing a quick login?

    Inconvenient to ask for password when using the app again after logging in
     
  5. Martin_Gonzalez

    Martin_Gonzalez

    Joined:
    Mar 25, 2012
    Posts:
    361
    @anflaoo
    You need to validate the state of the credentials, if they are not revoke you don't need to log in again.
    If credentials are revoked you need to take your user to your login page/or ask him to log in again.
     
  6. anflaoo

    anflaoo

    Joined:
    Mar 16, 2020
    Posts:
    4
  7. Martin_Gonzalez

    Martin_Gonzalez

    Joined:
    Mar 25, 2012
    Posts:
    361
    Sorry if I was not clear.
    You can check the credentials status before calling login. If credential are valid you dont need to call login.
    If credentials were revoked you can call login again to get the refreshed credentials
     
  8. anflaoo

    anflaoo

    Joined:
    Mar 16, 2020
    Posts:
    4
    @Martin_Gonzalez
    Sorry, I thought that the login screen should appear like Apple Game Center. However, when I played other games, I found that the screen saying that I was logged in again did not appear after the login process.
     
  9. Martin_Gonzalez

    Martin_Gonzalez

    Joined:
    Mar 25, 2012
    Posts:
    361
    One thing to be aware.
    Apple will give you the username just the first time the user logged in. Every other time the user log in again there will no info of the user, so you must persist it locally or in a server.

    The get back to the stat point you in your iphone can go to Settings>Your User(The first item)>Password & Security>Apps Using Your Apple ID> tap on your app and then Stop Using Apple Id.
    This will be like the very first time.