我是 swift 新手,所以请帮助我了解 FBSDK。获取 FB 帐户的 FB 页面。我需要它直接从我的应用程序发布在 fb 页面上。
问问题
272 次
1 回答
0
嗨,我自己找到了答案..这是我的答案..希望它对某人有所帮助:
let graphRequest
= FBSDKGraphRequest(graphPath: "/me/accounts?fields=access_token", parameters: ["access_token":FBSDKAccessToken.current().tokenString])
graphRequest.start(completionHandler: { (connection, result, error)-> Void in
if ((error) != nil)
{
print("Error: \(error)")
}
else
{
let array = ((result as! NSDictionary).value(forKey: "data") as! NSArray)
for tokens in array{
let tkn = ((tokens as! NSDictionary).value(forKey: "access_token")) as! String
let id = ((tokens as! NSDictionary).value(forKey: "id")) as! String
let obj = AccessToken() //NSOBject class containing accessToken and id variables...
obj.access_token=tkn
obj.id=id
self.accessTokenArray.append(obj) // global var to store AccessToken type array
}
}
})
于 2017-03-20T20:17:49.287 回答