我正在尝试创建一个开放图形对象,并将用户生成的照片上传到暂存资源,以便使用它发布操作。我正在使用适用于 iOS 的最新 Facebook SDK(3.5)。代码如下:
[FBRequestConnection startForUploadStagingResourceWithImage:self.image completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error){
NSString *uri = [result valueForKey:@"uri"];
NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPost];
object.provisionedForPost = YES;
object[@"type"] = @"<APP_NAME>:<OBJECT_NAME>";
object[@"url"] = uri;
object[@"title"] = @"My Title";
object[@"user_generated"] = @"true";
[FBRequestConnection startForPostOpenGraphObject:object
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
}];
}];
在完成块中startForPostOpenGraphObject
:我应该startForPostWithGraphPath
用新创建的对象的 id 调用。但是,我没有得到 id,而是一个错误:
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x1f2f14a0 {com.facebook.sdk:HTTPStatusCode=500, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 1;
message = "An unknown error has occurred.";
type = OAuthException;
};
};
code = 500;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x1f2ca300, state: FBSessionStateOpen, loginHandler: 0x1f2cb750, appID: **************, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x1e56ed00>, expirationDate: 4001-01-01 00:00:00 +0000, refreshDate: 2013-05-08 09:07:56 +0000, `attemptedRefreshDate`: 0001-12-30 00:00:00 +0000, permissions:(
"user_photos",
"publish_stream",
"publish_actions"
)>}
我究竟做错了什么?