我们正在尝试根据他们的网站使用 Facebook iOS SDK 3.14.1 创建 Facebook 测试用户:https ://developers.facebook.com/docs/graph-api/reference/v2.0/app/accounts/test-users
这是我们的代码:
NSString *fbAccessToken = [NSString stringWithFormat:@"%@",FBSession.activeSession.accessTokenData];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
@"true", @"installed",
fbAccessToken, @"owner_access_token",
nil
];
NSString *path = [NSString stringWithFormat:@"/%@/accounts/test-users", kFacebookID];
/* make the API call */
[FBRequestConnection startWithGraphPath:path ///{app-id}/accounts/test-users"
parameters:nil
HTTPMethod:@"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
)
{
if (result && !error)
{
NSLog(@"Test-User created successfully: %@", result);
}
else
{
NSLog(@"Error creating test-user: %@", error);
NSLog(@"Result Error: %@", result);
}
}];
当我们运行它时,我们会收到以下错误:
error = {
code = 15;
message = "(#15) This method must be called with an app access_token.";
type = OAuthException;
};
我们也尝试过不使用参数 owner_access_token,但会出现同样的错误。我们如何使用 Facebook iOS SDK 以编程方式创建 Facebook 测试用户?