How to change the string? to NSString?


i tried use as! NSString also didnt work…:frowning:

You should probably ask FireBase support - but how about using the NSString constructor?

NSString(string: String)

but if i want to use that…should i know what is the user input…i mean specifically…

btw thank you…i use yr method and its work just i cant do that when i use class as parameter…

OK let’s keep working it out. What’s your new error message? How do you mean

use class as parameter…

Is this another error message coming out of FIRAuth?

i mean i use an object…like i want to cast all of string to NSString…btw i got new message…i do have that data in firebase…when when i try to retrieve it,its return nil instead of value…

So it looks like the snapshot dictionary is not being populated with username as you expect.

BTW, why are you using the describing: initialiser there? It’s good for debug output but here don’t you just want to set the text of nameLabel? Isn’t a simpler way to do it:

    if let value = snapshot.value as? NSDictionary {
        self.nameLabel.text = String(value["username"])
    }

?

I tried that but still return to nil…

I didn’t expect that change to effect the nil problem, I just thought that was as simpler way to do it. It looks like the FIRAuth function is returning a nil snapshot value then? If that is the case you are going to have to check documentation and the inputs to that function carefully and to figure out why.

Have you checked the value of userID?

u mean uid??yeah i checked it…

i when i tried yr way to change nsdict to string the xcode insist to use init(describing) method n throw error if not using it

I’m not a Firebase user so how about describing the required inputs to that function that is giving you a nil dictionary in return, and what you are actually passing it? Is there a chance that it is supposed to be doing that, i.e. you don’t have a current user to report?