Facebook graph object/entity parsing SDK 4 in Swift

前端 未结 2 1580
再見小時候
再見小時候 2021-01-27 11:18

In Swift how do you parse the result of a fbk graph request? I have a nested dictionary and casting to [String: String] does not work. I have casted to NSDictionary which works

2条回答
  •  忘掉有多难
    2021-01-27 11:28

    This mess worked for me. I am using SWIFT 3.01 and FB Swift SDK

    if let responseDictionary = response.dictionaryValue {
    
                        print(responseDictionary["name"] ?? "")
    
                        let a = responseDictionary["picture"] as! NSDictionary
                        let b = a["data"] as! NSDictionary
                        let c = b["url"]
                        print(c ?? "")
    

提交回复
热议问题