ios - Swift - Google Firebase Authentication with Email -
i trying run example of google firebase authentication email. tried email example of https://github.com/firebase/quickstart-ios/blob/master/authentication/authenticationexampleswift/emailviewcontroller.swift errors in project.
my code looks this:
@ibaction func loginbuttontapped(_ sender: anyobject) { if let email = self.useremailtextfield.text, let password = self.userpasswordtextfield.text { showspinner({ // [start headless_email_auth] firauth.auth()?.signin(withemail: email, password: password) { (user, error) in // [start_exclude] self.hidespinner({ if let error = error { self.showmessageprompt(error.localizeddescription) return } self.navigationcontroller!.popviewcontroller(animated: true) }) // [end_exclude] } // [end headless_email_auth] }) } else { self.showmessageprompt("email/password can't empty") } }
i error on showspinner({...})
, @ end on self.showmessageprompt("email/password can't empty")
:
however, error end showmessageprompt
not appear on self.showmessageprompt
few lines before. maybe has swift version, tried convert 3, complete project broken after that.
because in quickstart-ios, uses bridging-header of uiviewcontroller+alerts.h
file not implemented , not added in project.
so 1 solution use uiviewcontroller+alerts.h
bridging header in view controller or remove/modify code code..
@ibaction func loginbuttontapped(_ sender: anyobject) { if let email = self.useremailtextfield.text, let password = self.userpasswordtextfield.text { // [start headless_email_auth] firauth.auth()?.signin(withemail: email, password: password) { (user, error) in // [start_exclude] if let error = error { print(error.localizeddescription) //show alert return } self.navigationcontroller!.popviewcontroller(animated: true) // [end_exclude] } // [end headless_email_auth] } else { print("email/password can't empty") //show alert } }
you can find uiviewcontroller+alerts.h
, uiviewcontroller+alerts.m
files here
Comments
Post a Comment