通过ios sdk将上传的facebook视频发布到朋友的墙上

时间:2011-08-21 21:07:56

标签: iphone objective-c facebook-graph-api

如果我拿这样的网址,我可以将视频发布到朋友的墙上:

http://www.facebook.com/video/video.php?v=10150344412195987

并将其放在墙上的“写东西......”字段中。它准确地发布我想要的。但是,如果我尝试使用以下方式通过图表api发布:

NSString *postUrl = @"http://www.facebook.com/video/video.php?v=10150344412195987";
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                    @"post this", @"message",
                                    postUrl, @"source",
NSString *graphPath = [NSString stringWithFormat:@"me/feed"];    
FBRequest *req = [facebook requestWithGraphPath:graphPath
                                    andParams:params
                                    andHttpMethod:@"POST"
                                    andDelegate:requestDelegate];

我收到此错误:

(#100) FBCDN image is not allowed in stream: http://www.facebook.com/video/video.php?v=10150344412195987

这有什么办法吗?我也尝试使用“link”参数而不是“source”,但后来我收到了这个错误:

Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x7fabf70 {error=<CFBasicHash 0x7fa4b90 [0x273a380]>{type = mutable dict, count = 2,
entries =>
2 : <CFString 0x7facfb0 [0x273a380]>{contents = "type"} = <CFString 0x7fb4370 [0x273a380]>{contents = "OAuthException"}
3 : <CFString 0x7fb4630 [0x273a380]>{contents = "message"} = <CFString 0x7fb4a50 [0x273a380]>{contents = "An unknown error has occurred."}
}
}'

为什么我能够手工发布到朋友的墙上,而不是通过图表api?

编辑:如果我可以在视频中标记用户,那将是理想的解决方案。

1 个答案:

答案 0 :(得分:0)

您不得直接上传fbcdn.net域上托管的图片/视频。这是一个限制,因为媒体并不总是被优化。这就是这个错误的意思。

如果您想了解如何将视频上传到用户的墙上,请参阅操作方法博文https://developers.facebook.com/blog/post/532/,但在您的情况下,您可能需要先在本地下载视频,然后再通过Graph API上传。< / p>

NSURL *url = [NSURL URLWithString:@"http://www.facebook.com/video/video.php?v=10150344412195987"];
NSData * videoData = [NSData dataWithContentsOfURL:url];