Search Unity

Sign in with apple

Discussion in 'iOS and tvOS' started by watermelonlab, Apr 25, 2020.

  1. watermelonlab

    watermelonlab

    Joined:
    Sep 17, 2015
    Posts:
    15
    I am implementing sign with apple using unity 2019.2.3. My question is how to disable apple sign in button when device os version is not iOS 13?
     
  2. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
  3. watermelonlab

    watermelonlab

    Joined:
    Sep 17, 2015
    Posts:
    15
  4. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    516
    If I understand your concerns correctly, the systemVersion is a string which you can parse, not an Enum that you need to explicitly write switch cases for, so you don't need to update the code for every iOS version number.

    You can use the Version class provided by the .NET Framework to do easy comparison, like so:
    Code (CSharp):
    1. using System;
    2. using UnityEngine.iOS;
    3. ...
    4. Version currentVersion = new Version(Device.systemVersion); // Parse the version of the current OS
    5. Version ios13 = new Version("13.0"); // Parse the iOS 13.0 version constant
    6.  
    7. if(currentVersion >= ios13)
    8. {
    9.     // Enable the button...
    10. }

    BTW, Apple gives developers 3 months to test with iOS beta every June after WWDC and submit app updates about two weeks prior to making the update public in late September. If you need to make sure your code works with the upcoming iOS, you should have plenty of time to test.
     
    Last edited: Apr 27, 2020
    roointan and thanhlmyasha like this.
  5. watermelonlab

    watermelonlab

    Joined:
    Sep 17, 2015
    Posts:
    15
  6. Cuicui_Studios

    Cuicui_Studios

    Joined:
    May 3, 2014
    Posts:
    72
    Quick question: Are you using the unity SignInWithApple package? Because we've been trying to implement it and haven't been able to make it work.
     
  7. jposey

    jposey

    Joined:
    Aug 14, 2014
    Posts:
    16
    Seems like this should be included in the Unity plugin with a method like IsSignInWithAppleAvailable()
     
  8. DarekRusin

    DarekRusin

    Joined:
    Nov 15, 2013
    Posts:
    47
    Exactly! I was looking for such method and was surprised that it's not there. Or I can't find it. In the end I went with the solution proposed by @Neonlyte
     
    badseed-gtino likes this.
  9. badseed-gtino

    badseed-gtino

    Joined:
    Jan 18, 2019
    Posts:
    6
    SignInWithApple is a very very basic plugin, I am using it just for the sake of using the "official" Unity plugin, but I was hoping the "upcoming" User Authentication was going to be released months ago... I assume that's why they did not write a more complete SignInWithApple solution quite yet.