6

In the latest beta 6 of Xcode 12, I'm having errors popping up when trying to resume a SwiftUI preview. The main error appears to be Cannot find type 'ASAuthorizationAppleIDButton' in scope. The code compiles perfectly fine when building or running on the simulator, and no errors show up. Only when I try to run a preview do things not work. Other errors I see are:

Type 'SignInAppleButton' does not conform to protocol 'UIViewRepresentable'
Cannot find type 'ASAuthorizationControllerDelegate' in scope
Cannot find 'ASAuthorizationAppleIDProvider' in scope
Cannot find type 'ASAuthorization' in scope

I have import AuthenticationServices at the top of my files. An important note is that the same project works perfectly fine without any errors on Xcode 12 beta 1.

A short term solution I've found is to remove all code using ASAuth (subsequently Signin with Apple) and switching from Firebase CocoaPods to their new Firebase Swift package manager. This makes previews work. Prior to switching from CocoaPods, I would get strange linker errors after removing ASAuth code.

My assumption is that I need to implement SwiftUI's new Signin with Apple button, but I don't know how to use it based on the little documentation provided by Apple.

This is the site my code references almost exactly the same: https://www.alfianlosari.com/posts/building-authentication-in-swiftui-using-firebase-auth-sdk-and-sign-in-with-apple/

Mark-4421
  • 159
  • 9
  • I'm using SwiftUI `SignInWithAppleButton` and also experience the same issue – Marcio Sep 12 '20 at 08:01
  • I just ran into this yesterday too! So far no one has an answer. I only have this issue on SwiftUI previews (along with other issues only when doing SwiftUI previews). I'll be filing a report on Feedback Assistant, everyone else should too. – Michael Ozeryansky Sep 12 '20 at 23:58
  • Also, while I was doing this with Firebase, I created a new project with just `ASAuthorizationAppleIDButton` in it and it also produced the error. No Firebase imported. – Michael Ozeryansky Sep 13 '20 at 00:00
  • 1
    This seems to be an issue in Xcode 12 beta 6. Opening a SwiftUI view that has this issue in Xcode 12 beta 5 instead works fine. Did you file feedback? – Peter Friese Sep 15 '20 at 13:19
  • Yeah, I filed feedback 2 weeks ago with almost exactly those words. I see that now there's "more than 10" similar reports to mine, so hopefully it's been noticed. – Mark-4421 Sep 15 '20 at 18:46
  • 1
    It seems like this has been fixed with Xcode 12.0 GM build 12A7209 (make sure to get the latest version - Apple published two(!) builds labelled 12A7209 - make sure to get the latest one). – Peter Friese Sep 16 '20 at 06:12
  • Thanks for letting us know! Just noticed that it's also been pushed to the App Store, so will update once that's finished downloading. – Mark-4421 Sep 16 '20 at 18:39

0 Answers0