Apple rejected my app because I only use Facebook login. So, I've spent the last several days trying to get sign in with apple to work. I have quadruple checked all the requirements and gone through several tutorials. Still, it will not work. ALL I need is the unique apple id. I do not need email, full name, nothing. When I press the sign in with apple button in my app, it works as far as adding my app to the devices sign in with apple list in Settings. However, it either skips the actual sign in code in Unity or gives an error depending on which method of sign in I used (login or quick login).
For the login code... I placed Debug.Logs to see what the values were in different steps. Oddly, the debug.logs are never executed indicating that the login code is never executed. Just skips right over it! Why? (I have revoked it and retried and it still skips this area) Here is the code. This code gives no errors. It just doesn't work.
code-block
public void signIn()
{
Debug.Log("0801 appleManager signIn");
var loginArgs = new AppleAuthLoginArgs(LoginOptions.None);
this.appleAuthManager.LoginWithAppleId(
loginArgs,
credential =>
{
// Obtained credential, cast it to IAppleIDCredential
var appleIdCredential = credential as IAppleIDCredential;
Debug.Log("0801 appleManager appleIdCredential = " + appleIdCredential);
if (appleIdCredential != null)
{
// Apple User ID
// You should save the user ID somewhere in the device
var userId = appleIdCredential.User;
ZPlayerPrefs.SetString(AppleUserIdKey, userId);
// Email (Received ONLY in the first login)
var email = appleIdCredential.Email;
// Full name (Received ONLY in the first login)
var fullName = appleIdCredential.FullName;
// Identity token
var identityToken = Encoding.UTF8.GetString(
appleIdCredential.IdentityToken,
0,
appleIdCredential.IdentityToken.Length);
// Authorization code
var authorizationCode = Encoding.UTF8.GetString(
appleIdCredential.AuthorizationCode,
0,
appleIdCredential.AuthorizationCode.Length);
// And now you have all the information to create/login a user in your system
Debug.Log("0801 appleManager APPLE ID = " + userId);
FBlogin.FBuserID = userId;
FBlogin.AppleUserID = userId;
}
else
Debug.Log("0801 appleIDCredential is NULL = " + appleIdCredential);
},
error =>
{
// Something went wrong
var authorizationErrorCode = error.GetAuthorizationErrorCode();
Debug.Log("0801 appleManager APPLE ID GET ERROR = " + authorizationErrorCode);
});
Debug.Log("AFTER apple login credential attemp AppleUserIdKey = " + AppleUserIdKey);
Debug.Log("AFTER apple login credential attemp FBlogin.FBuserID = " + FBlogin.FBuserID);
}
And here is the quick sign in method. When I run this, I DO get an error code. The error is:
2022-08-03 15:13:15.204512-0500 MMAFightClub2[32138:1295171] [Authorization] ASAuthorizationController credential request failed with error: Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1001 "(null)"
code-block
Debug.Log("0802 inside quick login");
var quickLoginArgs = new AppleAuthQuickLoginArgs();
this.appleAuthManager.QuickLogin(
quickLoginArgs,
credential =>
{
// Received a valid credential!
// Try casting to IAppleIDCredential or IPasswordCredential
// Previous Apple sign in credential
var appleIdCredential = credential as IAppleIDCredential;
Debug.Log("0802 quicksignin appleIdCredential = " + appleIdCredential);
// Saved Keychain credential (read about Keychain Items)
var passwordCredential = credential as IPasswordCredential;
Debug.Log("0802 quicksignin passwordCredential = " + passwordCredential);
},
error =>
{
// Quick login failed. The user has never used Sign in With Apple on your app. });
Debug.Log("0802 quick login failed, going to logIn()");
logIn();
});
}
I have made sure the entitlements file has been created.
Xcode has the iphone target > Sign i with Apple capability added
Xcode UnityFramework > build phases > link binary with libraries has the authentication services framework added
I have added sign in with apple on the project account on Apple dev page
After 1.5 years of development, the game is finished but now 100% stuck on this. Not happy and frustrated. It is probably something simple that I am missing.
Can anyone help me? Thank you.