Swift: Proper Firebase error-handling -


i'm not able understand why neither print lines executed when running following code:

ref.child("schools/\(schooltextfield.text!)/settings/pin").observesingleevent(of: .value, with: { (snapshot) in     print(snapshot.value) }, withcancel: { (error) in     print(error.localizeddescription) }) 

it used work, until made changes regarding firebase authentication, don't see why withcancel block not executed!

how catch whatever error occuring here? no error-message printed in log.

edit: found similar question here suggests problem might related authentication after all. in appdelegate's didfinishlaunchingwithoptions check if user auth-token exists in firebase auth:

auth.auth().currentuser?.getidtokenforcingrefresh(true, completion: { (response, error) in     guard error == nil, let uid = response else {         print(error)         return     }     ... }) 

in current case there error, printed:

error domain=firautherrordomain code=17011 "there no user record corresponding identifier. user may have been deleted."

i'm getting these errors printed in log:

[common] _bsmacherror: port b43b; (os/kern) invalid capability (0x14) "unable insert copy_send" [common] _bsmacherror: port b43b; (os/kern) invalid name (0xf) "unable deallocate send right"

try way:

if let snapshot = snapshot.children.allobjects as? [datasnapshot] {  snap in snapshots {    print("snap: \(snap)")  } 

also error code 17011 user not found error see firautherrorcode more info it's better create dataservice class handle interaction firebase see creating reusable firebase data service more info.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -