如何访问Facebook图形中的数据请求结果响应

时间:2019-03-09 19:25:41

标签: ios swift facebook-graph-api facebook-ios-sdk

我可以使用Facebook登录,并且可以登录,获取详细信息等。但是让我感到困扰的是如何从graphapi调用的结果响应中读取数据。

Optional({
    data =     {
        height = 50;
        "is_silhouette" = 1;
        url = "https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=108656723630605&height=50&width=50&ext=1554751119&hash=AeRq_Hgo5yU28P3f";
        width = 50;
    };
})

以上是我的回复,我想访问url参数。

我的代码(这很糟糕,请提前对不起)是:

FBSDKGraphRequest(graphPath: friendID, parameters: ["fields":"picture"])?.start(completionHandler: { (connection, result, error) in
    if error != nil{
        print("Error in getting friends picture")
    } else {
        let friendPicture = result as! [String:AnyObject]
        print(friendPicture["picture"])
        let nestedJSON = friendPicture["picture"] //as? [[String:String]]
        print("The below should be just URL// above is entire response")
    }
})

0 个答案:

没有答案