gpt4 book ai didi

ios - requestTestAccountTokensWithArraysOfPermissions FBSDK 4.x 版本

转载 作者:行者123 更新时间:2023-11-28 09:06:58 25 4
gpt4 key购买 nike

我正在尝试使用以下方法返回之前创建的 Facebook 测试用户:

let manager = FBSDKTestUsersManager.sharedInstanceForAppID(myAppId, appSecret: myAppSecret)
manager.requestTestAccountTokensWithArraysOfPermissions(nil, createIfNotFound: false)
{
(objects: [AnyObject]!, error: NSError!) -> Void in

if error != nil
{
// oops, error
}
else
{
if let token = objects[0] as? FBSDKAccessToken
{
//do something with token
}
}

但是 objects[0] 不是获取访问 token ,而是包含一个 NSNull 对象。测试用户之前是在代码中创建的,并显示在 developers.facebook.com 上我的应用仪表板中

顺便说一下,使用“createIfNotFound: true”运行相同的代码非常有效

任何帮助将不胜感激

最佳答案

好吧,我永远无法让它发挥作用。我最终推出了自己的产品,使用“FBSDKTestUserManager.m”中的代码作为起点。

let graphPath = "\(myAppId)/accounts/test-users"
var params = ["limit": "5"]
let tokenString = "\(myAppId)|\(mAppSecret)"
let request = FBSDKGraphRequest(graphPath: graphPath, parameters: params, tokenString: appAccessToken(), version: nil, HTTPMethod: nil)

request.startWithCompletionHandler
{ (connection: FBSDKGraphRequestConnection!, result: AnyObject!, error: NSError!) -> Void in

if let frObjs = dictionary["data"] as? [[String: AnyObject]]
{
for frObj in frObjs
{
let id = frObj["id"]
let access_token = frObj["access_token"]
let login_url = frObj["login_url"]
// now there's enough info to either login as the test user,
// or manually create an FBSKDAccessToken
}
}
}

关于ios - requestTestAccountTokensWithArraysOfPermissions FBSDK 4.x 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30556731/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com