我的图形请求一直收到这个错误?
Type ‘Any?’ has no subscript members
错误点在结果….这只发生在我转换为swift 3 …任何人????
let nextrequest: FBSDKGraphRequest = FBSDKGraphRequest(graPHPath: "me/friends",parameters: ["fields": "name,id,gender"],httpMethod: "GET") nextrequest.start { (connection,result,error) -> Void in guard let listOfFriends = result["data"] as? [AnyObject] else { return } } }
解决方法
试试这个
let nextrequest: FBSDKGraphRequest = FBSDKGraphRequest(graPHPath:"me/friends",httpMethod: "GET") nextrequest.start { (connection,error) -> Void in guard let result = result as? [String:[AnyObject]],let listOfFriends = result["data"] else { return } } }