ios - Prevent multiple devices from using the same Firebase account through Swift -


i'm building ios app using swift , firebase authentication needs avoid multiple connections of same account different devices. i've read other posts on here haven't found definitive answer why isn't working. first tried checking see if current user nil below code (which shows nil due async calling).

    if auth.auth().currentuser == nil {      // ...     } 

i tried using addstatedidchangelistener() callback function in viewdidload() , while fire when sign in occurs, still doesn't return connected sessions or show current user signed in when login same credentials on different device.

    auth.auth().addstatedidchangelistener { (auth, user) in     // ...     } 

is there better way check if account i'm trying sign firebase signed in (or not signed out of previous session)?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -