firebase-ios-sdk: Firebase Auth - Phone Auth not working on iOS 13 with SwiftUI
Development Environment:
- Xcode version: 11 beta 6
- Firebase SDK version: 6.7.0
- Firebase Component: Auth
- Component version: 6.2.3
Steps to reproduce:
- Create a new SwiftUI project and add the Firebase Core and Auth SDKs using Cocoapods
- Set up the project for Phone Auth.
- Create the UI for the user to provide their phone.
- Call
verifyPhoneNumber:UIDelegate:completionusing the phone provided. - A webView opens in order for you to solve a reCaptcha.
- Solve the reCaptcha.
- Get an about:blank page
- The dismiss delegate is never called.
I am guessing this might have to do something with the new SceneDelegate, but I am not sure.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 18 (4 by maintainers)
Not only SwiftUI, but also UIKit has same. If you use
SceneDelegate, we should add below and it works for me.you can use Integration testing until they fix this issue
On iOS, the appVerificationDisabledForTesting setting has to be set to TRUE before calling verifyPhoneNumber. This is processed without requiring any APNs token or sending silent push notifications in the background, making it easier to test in a simulator. This also disables the reCAPTCHA fallback flow.
https://firebase.google.com/docs/auth/ios/phone-auth#integration-testing
Thank you It worked but the code snippet
func scene(_ scene: UIScene, openURLContexts URLContexts: Set)give errorReference to generic type 'Set' requires arguments in <...>according to Apple documentation it should befunc scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)Please make sure itâs added to your SceneDelegate, not ApplicationDelegate.
I tried it by add to appDelegate
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { for urlContext in URLContexts { let url = urlContext.url Auth.auth().canHandle(url) } }but it didnât work still about:blank checked it on Xcode 11 with the simulator Iâm using Storyboard not SwiftUIHi @nikolouzos, could you help try the fix on the brach âswift-uiâ?
You can do that by changing your podfile to
Please let me know if the fix works for you, also please confirm that the fix doesnât affect your existing code.