如何在 iOS 12 或更早版本中与苹果集成登录? [英] How to integrate sign in with apple in iOS 12 or earlier?

查看:58
本文介绍了如何在 iOS 12 或更早版本中与苹果集成登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于第三方登录服务,我的应用被拒绝.所以我已经为 iOS 13 实现了使用 Apple 登录.问题是如何为 iOS 12 或更早版本提供向后兼容性.

My app was rejected due to a third-party login service. So I've implemented Sign in with Apple for iOS 13. Problem is how to provide backward compatibility for iOS 12 or earlier.

推荐答案

就我而言,它仅在我避免为 sha256 导入 CryptoKit 时才有效(适用于 iOS12 及以下)强> 加密.您可以通过导入 CommonCrypto 来扩展 String 类,添加一个 sha256 函数,而不是使用 CryptoKit 提供的 sha256 函数.

In my case, it only works (for iOS12 and below) if I avoid importing CryptoKit for the sha256 encryption. Instead of using the sha256 function provided by CryptoKit you can extend the String class adding a sha256 function by importing CommonCrypto.

您可以在此处查看我的回答中的代码:https://stackoverflow.com/a/60987888/2025766

You can check the code in my answer here: https://stackoverflow.com/a/60987888/2025766

在 iOS12 及更低版本上导入 CryptoKit 会使您的应用程序崩溃并出现此错误:

Importing CryptoKit on iOS12 and below will crash your app with this error:

Library not loaded: /System/Library/Frameworks/CryptoKit.framework/CryptoKit"

应用启动时.

我还尝试使用 #if canImport(CryptoKit) 进行条件导入并在其他链接器标志中设置 -weak_framework CryptoKit,但仍然在 iOS12 中崩溃.到目前为止,避免 CryptoKit 是我找到的唯一解决方案.

I also tried to use #if canImport(CryptoKit) for conditional import and set -weak_framework CryptoKit in Other Linker Flags but still crashing for iOS12. So far avoid CryptoKit is the only solution that I found.

这篇关于如何在 iOS 12 或更早版本中与苹果集成登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆