Got crash:`EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000` on `ASAuthorizationAppleIDRequest#requestedScopes = [.fullName, .email]`

[SIGN IN WITH APPLE]


We got a crash:EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000 on `ASAuthorizationAppleIDRequest#requestedScopes = [.fullName, .email]`.

This Crash rarely occurs in iOS13 ~ 13.3.x.

The code is below. I don't think we are doing anything special.


    @available(iOS 13.0, *)
    private func signInWithAppleOnOS13Later() {
        let provider = ASAuthorizationAppleIDProvider()
        let req = provider.createRequest()

        // Crash`EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000` rarely occurs.
        req.requestedScopes = [.fullName, .email]

        let controller = ASAuthorizationController(authorizationRequests: [req])
        controller.presentationContextProvider = self
        controller.delegate = self
        controller.performRequests()
    }


Could anyone advise us any points we should check to resolve this crash?

Answered by mpms in 627912022
Same here, exact same line:
Code Block
guard #available(iOS 13.0, *) else { return }
let appleIDProvider = ASAuthorizationAppleIDProvider()
let request = appleIDProvider.createRequest()
request.requestedScopes = [.fullName, .email] /* EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000 */
let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.delegate = self
authorizationController.presentationContextProvider = self
authorizationController.performRequests()

The crash seems kinda random (at least we could not reproduce it ourselves).

iPhone: 100% (no crash on iPads)
Jailbroken: ~41%
iOS: 13.0 - 13.3.1 (never saw it in 13.4+)

So my best guess here is, that this is an SDK issue, that was fixed in 13.4 (though it's not mentioned in any release notes).
Therefore I think there's no solution but to wait until 13.3.x can be discontinued due to low users on that version in about 1-2 years?! 😬

Or it is really a jailbreak issue. At least the jailbreak percentage is really huge on this crash. So maybe if Firebase does not detect all jailbroken device, it would be an explanation for that, too?!

But that said, we would indeed be totally happy if there is a solution right now 😀
Getting the same crashes in Firebase and I want to pay attention that mostly app crashes for jailbroken device so it can be connected with this somehow. Haven't found solution yet.
got same errors to me, it occurs both device (jailbroken and not)
sadly, We can't reproduce this crash ;( but it occurs.
Same here we get this crash show up in our in our crash monitoring tool but can't recreate it.

All previous crash have an approximate 0% to 1% Jailbreak users.

This crash has a 20% to 30% Jailbreak users.

Any one know has fixed this please do share.
Accepted Answer
Same here, exact same line:
Code Block
guard #available(iOS 13.0, *) else { return }
let appleIDProvider = ASAuthorizationAppleIDProvider()
let request = appleIDProvider.createRequest()
request.requestedScopes = [.fullName, .email] /* EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000 */
let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.delegate = self
authorizationController.presentationContextProvider = self
authorizationController.performRequests()

The crash seems kinda random (at least we could not reproduce it ourselves).

iPhone: 100% (no crash on iPads)
Jailbroken: ~41%
iOS: 13.0 - 13.3.1 (never saw it in 13.4+)

So my best guess here is, that this is an SDK issue, that was fixed in 13.4 (though it's not mentioned in any release notes).
Therefore I think there's no solution but to wait until 13.3.x can be discontinued due to low users on that version in about 1-2 years?! 😬

Or it is really a jailbreak issue. At least the jailbreak percentage is really huge on this crash. So maybe if Firebase does not detect all jailbroken device, it would be an explanation for that, too?!

But that said, we would indeed be totally happy if there is a solution right now 😀
Many thanks for your replies🙏

Just in case, We were able to avoid the crash with the following code.
I hope that this information is helpful to you🙏

Code Block swift
   @available(iOS 13.0, *)
  private func signInWithAppleOnOS13Later() {
    let provider = ASAuthorizationAppleIDProvider()
    let appleIDRequest: ASAuthorizationAppleIDRequest? = provider.createRequest()
    guard let req = appleIDRequest else {
      /* Rarely come here !!!!!! */
      return
    }
    let scopes: [ASAuthorization.Scope] = [.fullName, .email]
    req.requestedScopes = scopes
    let controller = ASAuthorizationController(authorizationRequests: [req])
    controller.presentationContextProvider = self
    controller.delegate = self
    controller.performRequests()
  }


Got crash:`EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000` on `ASAuthorizationAppleIDRequest#requestedScopes = [.fullName, .email]`
 
 
Q