Apple 在下方登录 ios13

Apple Sign In below ios13

我对 Apple Sign In 有疑问。在 App Store Guideline 中我们可以发现,当应用程序使用第三方登录选项(如 google 或 facebook)时,Apple Sign in 是强制性的。据我所知,Apple 登录机制是在 ios 13 中添加的。如果我想构建将 iOS 的最低版本设置为 11 或 12 的应用程序怎么办?我仍然需要实施 Apple 登录(如果需要,如何实施?)?

如您所说,iOS13 中添加了 Apple 登录机制。如果您想支持旧版本的 iOS,您将必须为这些用户提供其他登录方法。

在代码中,您使用 #available 检查 iOS 版本并围绕它进行逻辑处理。

Swift:

if #available(iOS 13, *) {
    // Apple sign in code logic
    // Other methods logic
} else {
    // Other methods logic
}

Objective C:

if (@available(iOS 13, *)) {
    // Apple sign in code logic
    // Other methods logic
} else {
    // Other methods logic
}
private func setupLoginWithAppleButton() {
        if #available(iOS 13.0, *) {
            //Show sign-in with apple button. Create button here via code if you need. 
        } else {
            // Fallback on earlier versions
            //Hide your sign in with apple button here.
        }
    }

如果您遇到错误:授权返回错误:操作无法完成。 (com.apple.AuthenticationServices.AuthorizationError 错误 1000。)

Simply Add "Sign In with Apple" from Capability.

没有必要支持低于ios13的,但你也可以支持低于ios13的。你可以阅读这个指南 https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/incorporating_sign_in_with_apple_into_other_platforms

首先,您必须为重定向配置您的应用程序 url,最重要的是,您必须使用您想要提供苹果登录 Android、Web 或其他平台的机制。

我发现最好的配置教程是: https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple 如果配置成功则

按照这些步骤 1-将您的按钮代码放入后备 os 版本。

2-在按钮上设置苹果登录图像你可以从这里下载按钮图像https://appleid.cdn-apple.com/appleid/button

3- 如果您成功按照教程进行操作,然后单击登录按钮并打开此 api https://appleid.apple.com/auth/authorize?response_type=code&response_mode=form_post&client_id=[your苹果登录客户端id]&redirect_uri=https%3A%2F%2Fexample-app.com%2Fredirect&state=78536bf485&scope=name+email

在 wkwebview 中或在应用程序之外,具体取决于您 然后你会看到这样的画面 输入您的苹果登录凭据然后如果您成功它将重定向到您的重定向uri

是的,同样的要求适用于 iOS 早于 iOS 的版本 13. Apple 员工在 Apple Developer 论坛上提供了这个答案:https://forums.developer.apple.com/thread/122755

For iOS 13 and later, macOS 10.15 and later, tvOS 13 and later, and watchOS 6 and later, use the AuthenticationServices framework as referenced here.

For iOS 12 and eariler, macOS 10.14 and earlier, tvOS 12 and earlier, and watchOS 5 and earlier, as well as web applications which cannot directly access Sign in with Apple JS framework, you must manually control the sign-in request as referenced here.