first configure your project to firebase
in authentication section in signing method phone enable
download info playlist and add in project by drag and drop
install required pod
AppDelegate in Add
import Firebase
import FirebaseAuthUI
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
}
in View-Controller Sie Telefonnummer
überprüfen müssen
import FirebaseAuth
import FirebaseAuthUI
import FirebasePhoneAuthUI
class viewController: UIviewcontroller,FUIAuthDelegate {
override func viewDidLoad() {
super.viewDidLoad()
FUIAuth.defaultAuthUI()?.delegate = self
let phoneProvider = FUIPhoneAuth.init(authUI: FUIAuth.defaultAuthUI()!)
FUIAuth.defaultAuthUI()?.providers = [phoneProvider]
phoneProvider.signIn(withPresenting: self, phoneNumber: nil)
}
func authUI(_ authUI: FUIAuth, didSignInWith user: User?, error: Error?) {
if let user = user {
print("I'm logged in")
}
else {
print(error?.localizedDescription ?? "Something went wrong")
}
}
Erklären Sie mit Details. –
können Sie verweisen doc https://firebase.google.com/docs/auth/ios/phone-auth –
Fügen Sie ein Geräte-Token hinzu? –