Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwiftUI SignInWithAppleButton Hangs

I am trying to implement Sign in With Apple with SwiftUI, but it hangs after I enter the correct password.

I am using a real user and the simulator and XCode 12.0 Beta. Unfortunately, I do not have a device available right now to test on. I also tried with Sandbox users without success.

I have added the sign in with apple capability to the provisioning profile

The print statement for success is never reached.

What am I missing?

ui

Using the sample code from https://developer.apple.com/documentation/swiftui/signinwithapplebutton

import SwiftUI
import AuthenticationServices

struct SignInView: View {
    var body: some View {
        VStack {
            SignInWithAppleButton(
                .signIn,
                onRequest: { request in
                    request.requestedScopes = [.fullName]
                },
                onCompletion: { result in
                    switch result {
                    case .success (let authResults):
                        print("rhe01 Authorization successful.")
                    case .failure (let error):
                        print("rhe01 Authorization failed: " + error.localizedDescription)
                    }
                }
            )
        }
    }
}
like image 522
Ryan Heitner Avatar asked Jul 03 '20 10:07

Ryan Heitner


Video Answer


1 Answers

This was a bug in the Simulator that was introduced in Xcode 12.0b1 - see this thread on Apple's forums. The good news is that this has now been fixed in Xcode 14, which is in beta as of this writing.

  • UPDATE 2022-06-06] Tested and FIXED in Xcode 14.0 beta (14A5228q)
    • Simulator Version 14.0 (982)
    • SimulatorKit 620
    • CoreSimulator 842.7

Full testing history

  • [UPDATE 2022-05-13] Tested and still not working in Xcode 13.4 RC (13F17a) with the following Simulator versions:

    • Simulator Version 13.4 (977.2)
    • SimulatorKit 618
    • CoreSimulator 802.6.1
  • [UPDATE 2022-03-13] Tested and still not working in Xcode 13.3 (13E113) with the following Simulator versions:

    • Simulator Version 13.3 (977.2)
    • SimulatorKit 618
    • CoreSimulator 802.6
  • [UPDATE 2022-01-27] Tested and still not working in Xcode 13.3 beta (13C90) with the following Simulator versions:

    • Version 13.3 (977.1)
    • SimulatorKit 618
    • CoreSimulator 802.3
  • [UPDATE 2021-12-07] Tested and still not working in Xcode 13.2 RC (13C90) with the following Simulator versions:

    • Version 13.2 (972.2)
    • SimulatorKit 613.1
    • CoreSimulator 783.5
  • [UPDATE 2021-10-18] Tested and still not working in Xcode 13.1 RC (13A1030d) with the following Simulator versions:

    • Version 13.1 (970)
    • SimulatorKit 612
    • CoreSimulator 776.4
  • [UPDATE 2021-09-14] Tested and still not working in Xcode 13 RC (13A233) with the following Simulator versions:

    • Version 13.0 (970)
    • SimulatorKit 612
    • CoreSimulator 776.3
  • [UPDATE 2021-06-30] Tested and still not working in Xcode 13 beta 2 (13A5155e) with the following Simulator versions:

    • Version 13.0 (967.1)
    • SimulatorKit 611
    • CoreSimulator 772.1
  • [UPDATE 2021-06-08] Tested and still not working in Xcode 13 beta 1 (13A5154h) with the following Simulator versions:

    • Version 13.0 (967.1)
    • SimulatorKit 611
    • CoreSimulator 772.1
  • [UPDATE 2021-04-22] Tested and still not working in Xcode 12.5 RC (12E262) with the following Simulator versions:

    • Version 12.5 (961.1)
    • SimulatorKit 609
    • CoreSimulator 757.5
  • [UPDATE 2021-01-22] Tested and still not working in Xcode 12.4 RC (12D4e) with the following Simulator versions:

    • Version 12.4 (940.20)
    • SimulatorKit 597.13.0.1
    • CoreSimulator 732.18.6
  • [UPDATE 2020-11-16] Tested and still not working in Xcode 12.2 RC (12B45b) with the following Simulator versions:

    • Version 12.2 (940.16)
    • SimulatorKit 597.13.0.1
    • CoreSimulator 732.18.0.2
    • (yep - the Simulator versions haven't changed, so no surprise here)
  • [UPDATE 2020-10-22] Tested and still not working in Xcode 12.2 beta 3 (12B5035g) with the following Simulator versions:

    • Version 12.2 (940.16)
    • SimulatorKit 597.13.0.1
    • CoreSimulator 732.18.0.2
  • [UPDATE 2020-10-15] Tested and still not working in Xcode 12.1 GM Seed with the following Simulator versions:

    • Version 12.1 (940.16)
    • SimulatorKit 597.13
    • CoreSimulator 732.18
  • [UPDATE 2020-09-29] Tested and still not working in Xcode 12.2 beta 2 with the following Simulator versions (no surprise - same versions as beta 1):

    • Version 12.2 (940.16)
    • SimulatorKit 597.13
    • CoreSimulator 732.18
  • [UPDATE 2020-09-18] Tested and still not working in Xcode 12.2 beta with the following Simulator versions:

    • Version 12.2 (940.16)
    • SimulatorKit 597.13
    • CoreSimulator 732.18
  • [UPDATE 2020-09-15] Still(!) not fixed in Xcode 12.0 GM Seed, with the following Simulator versions:

    • Version 12.0 (940.16)
    • SimulatorKit 597.13
    • CoreSimulator 732.17
  • [UPDATE 2020-08-26] Still not fixed in Xcode 12b6 (it actually seems like Apple didn't update the Simulator between b5 and b6 - both drops show the following versions:

    • Version 12.0 (940.16)
    • SimulatorKit 597.13
    • CoreSimulator 732.13
  • [UPDATE 2020-08-18] This is still an issue in Xcode 12b5. I've updated FB8281892 accordingly.

  • [UPDATE 2020-08-06] This is still an issue with Xcode 12b4. I've filed FB8281892 with details.

like image 115
Peter Friese Avatar answered Oct 16 '22 14:10

Peter Friese