【发布时间】:2019-01-01 04:39:45
【问题描述】:
我是 swift 的新手,我现在正在研究 Facebook graph api。我无法访问来自图形请求的数据。
struct MyProfileRequest: GraphRequestProtocol {
struct Response: GraphResponseProtocol {
init(rawResponse: Any?) {
// Decode JSON from rawResponse into other properties here.
let json = JSON(rawResponse!)
let userDef : [String : String] = [
"username" : json["name"].stringValue,
"lastname" : json["last_name"].stringValue,
"shortname" : json["short_name"].stringValue,
"name_format" : json["name_format"].stringValue
]
}
}
var graphPath = "/me"
var parameters: [String : Any]? = [ "fields": "id, name, last_name, name_format, short_name"]
var accessToken = AccessToken.current
var httpMethod: GraphRequestHTTPMethod = .GET
var apiVersion: GraphAPIVersion = .defaultVersion
}
我需要访问此块之外的“userDef”字典。
【问题讨论】:
标签: ios swift facebook facebook-graph-api