ios – swift 3:输入’Any?’没有下标成员

前端之家收集整理的这篇文章主要介绍了ios – swift 3:输入’Any?’没有下标成员前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的图形请求一直收到这个错误

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
    }
  }
}
原文链接:/iOS/330520.html

猜你在找的iOS相关文章