Does implementing the new Sign in With Apple feature make an app incompatible with iOS 12 and below, similar to SwiftUI? Will it be possible to compile an app which has to import AuthenticationServices on something like XCode 10?
-
You are really asking two things here. You can make an app compatible with lower versions of iOS using `@available` to "hide" the sign in with Apple code on lower versions. Your second question is compiling your project in Xcode 10; this won't be possible since you will be using the iOS 13 SDK in your project – Paulw11 Sep 13 '19 at 20:09
-
@Paulw11 Can I able to support sign in with apple for the lowest modals – sejn Oct 27 '21 at 12:25
-
What do you mean "lowest models"? If you mean iOS version, you can't support it prior to iOS 12, but it works on any iOS device running iOS 12 or later. – Paulw11 Oct 27 '21 at 18:39
2 Answers
Sign in with Apple itself doesn't make the whole app incompatible with iOS 12 and earlier (the same is for SwiftUI).
But when you need to support this kind of feature (which is available starting iOS 13) you'll need to use @available(iOS 13.0, *) attribute and if #available(iOS 13.0, *) checks to conditionally disable support of those features. Otherwise you'll have compilation errors and/or crashes on devices running older versions of iOS.
If you need to support Sign in with Apple on earlier versions of iOS (as well as non-iOS platform), as mentioned by Apple Staff, you should use Sign in with Apple JS framework.
For you second question, as @Paulw11 mentioned, the answer is No, since Xcode 10 doesn't include iOS 13 SDK.
- 2,150
- 2
- 23
- 30
-
Thanks Apple for forcing us to use an iOS 13 exclusive feature. Therefore forcing us to use Xcode 11 and writing nasty code using all those ugly available annotations and checks >.< The suggested alternative is a JS framework... SRSLY? – d4Rk Jan 22 '20 at 14:03
-
I need a full example of how to implement signing with apple js for ios 12. – Muhammed Alkabani Sep 17 '20 at 11:15
-
@Eugene Berdnikov So in iOS there is no option to support sign in with app in lower iOS versions. Am I correct? – sejn Oct 27 '21 at 12:53
-
@sejn there is no option to support Sign in with Apple using native iOS SDK (Authentication Services framework) on iOS 12 and earlier – Eugene Berdnikov Nov 03 '21 at 22:20
If you want backward compatibility I suggest avoiding using CryptoKit for sha256 encryption. You can use this String extension importing CommonCrypto instead CryptoKit.
import CommonCrypto
extension String {
var sha256: String {
let data = Data(utf8)
var hash = [UInt8](repeating: 0, count: Int(CC_SHA256_DIGEST_LENGTH))
data.withUnsafeBytes { buffer in
_ = CC_SHA256(buffer.baseAddress, CC_LONG(buffer.count), &hash)
}
return hash.map { String(format: "%02hhx", $0) }.joined()
}
}
I already tried to use #if canImport(CryptoKit) for conditional import and set -weak_framework CryptoKit in Other Linker Flags but still crashing for iOS12 and below. So far the only way to make it work is avoiding importing CryptoKit.
- 1,343
- 18
- 24
-
Could you please confirm, does the Sign in with Apple support is available for lowest iOS versions? – sejn Oct 27 '21 at 12:54