ios - Swift 3 Firebase NSString * type -
i'm using firebase library call requires string of type nsstring *
i'm new swift don't know means. have noticed if use literal works fine, if use variable thread abort.
i have
let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let email = appdelegate.email let fullname = appdelegate.fullname
and want this
let newuser = ["name" : fullname] let users = self.ref.child("users") let currentuser = users.childbyappendingpath(email) currentuser.setvalue(newuser)
but childbyappendingpath(email)
requires type nsstring *
is there way can convert email
literal/const/static ? i'm kind of lost here.
here email
, fullname
in appdelegate
file
var fullname = string() var email = string() func signin(signin: gidsignin!, didsigninforuser user: gidgoogleuser!, witherror error: nserror!) { if (error == nil) { // perform operations on signed in user here. fullname = user.profile.name email = user.profile.email
per recommendation of ravi prakash verma (below) tried declaring email
, fullname
s nsstring
it's complaining parameter should string?
your fullname
, email
of type nsstring *
. can check reference of gidprofiledata
class here.
update
you can make following change in appdelegate.
var fullname: string! var email: string! func signin(signin: gidsignin!, didsigninforuser user: gidgoogleuser!, witherror error: nserror!) { if (error == nil) { // perform operations on signed in user here. fullname = user.profile.name string email = user.profile.email string
Comments
Post a Comment