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.
4 Answers
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.
You can check the code in my answer here: https://stackoverflow.com/a/60987888/2025766
Importing CryptoKit on iOS12 and below will crash your app with this error:
Library not loaded: /System/Library/Frameworks/CryptoKit.framework/CryptoKit"
when the app starts.
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.
- 1,343
- 18
- 24
Add -weak_framework Cryptokit in Other Linker Flags of respective target's build settings.
- 434
- 3
- 15
Apple nowadays recommends it's Sign in with Apple JS in combination with their REST API.
You basically create an own button that uses the Apple Marketing resource images and then call their REST API to initiate the authorization flow. For the initial log-in window, you can use a WKWebView and handle the callback URL via the successful / failed redirect.
- 11,422
- 8
- 28
- 49