I have an app with a min target of iOS 11. However, I need to support Sign In With Apple, so I'm adding a sign in with apple button to my stack view like this:
private var appleButton: UIControl
// Has to be a UIControl because ASAuthorizationAppleIDButton not supported in <iOS 13
private func setupAppleSignIn() {
guard #available(iOS 13, *) else {
return
}
let button = ASAuthorizationAppleIDButton(
authorizationButtonType: .signIn,
authorizationButtonStyle: .white
)
button.cornerRadius = button.bounds.height/2
stackView.insertArrangedSubview(button, at: 0)
button.addTarget(self, action: #selector(handleSignInWithApple), for: .touchUpInside)
appleButton = button
}
@objc
func handleSignInWithApple() {
print("fired")
}
This successfully adds the button to my stackview. However, when I tap it, it doesn't fire my handleSignInWithApple function. Why?
UPDATE
It's only firing if I drag my finger a bit and release it. If I just tap, it doesn't work! Why?
If you get a message that your Apple ID is locked or disabled. If you or someone else enters your password, security questions, or other account information incorrectly too many times, your Apple ID automatically locks to protect your security and you can't sign in to any Apple services.
Go to Settings > Passwords. Under Security Recommendations, tap an app or website name. * Tap Use Sign in with Apple, then follow the onscreen steps.
Apple Sign-in doesn't work with ios-14 simulator in Xcode 12.
If you can't use your Apple ID to create an account for a new app, make sure “Sign in with Apple” is supported. This feature is not available for children under 13. Log out of your Apple account on all your devices, restart them, and sign back in. If the issue persists, reset all your iOS settings.
Turns out it was a bug in Xcode that has since been fixed. Just update Xcode if you're having this problem, or add a UITapGestureRecognizer
on the button!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With