2017-02-15 4 views
-4
struct LoginUser { 
    let key: String 
    let uid: String 
    let email: String 
    let ref:FIRDatabaseReference 

    init(snapshot:FIRDatabaseReference) { 
     key = snapshot.key 
     ref = snapshot.ref 
     let snapshotValue = snapshot.value as! [String: AnyObject] // here it is giving me ambiguous use of 'value' 
     if (snapshotValue["uid"] != nil){ 
      uid = snapshotValue["uid"] as! NSDictionary 
     } 
     else{ 
      uid = "" 
     } 

     email = snapshotValue["email"] as! String 
    } 
} 
+0

Sie haben uns mehr zu geben. Welche Variable ist mehrdeutig? Fügen Sie Ihren gesamten Fehler ein –

+0

Was ist die Frage? Ich sehe nur, dass Sie versuchen, einem 'String' ein' NSDictionary' (!) Zuzuweisen. Erstens, benutze 'NSDictionary' nicht, aber benutze' Dictionary', Second 'NSDictionary'! =' String' –

+0

@ MichałKwiecień Ich habe geschrieben // hier gibt es mir mehrdeutige Verwendung von 'Wert' – user3655325

Antwort

1

Diese

init(snapshot:FIRDatabaseReference) { 

Bedürfnisse sein, diese

init(snapshot:FIRDataSnapshot) { 

und dann

let uid: String 

bedeutet, es ist ein String so dieses

ändern
 uid = snapshotValue["uid"] as! NSDictionary 

dieser

 uid = snapshotValue["uid"] as! String