简体   繁体   中英

Post uploaded facebook video to friend's wall via ios sdk

I am able to post a video to a friends wall if I take a url like this:

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

and put that in the "Write something ...." field on their wall. It posts exactly how I want. However if I try posting via the graph api using this:

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];

I get this error:

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

Is there any way around this? I also tried using the "link" parameter instead of "source" but then I get this error:

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."}
}
}'

Why am I able to post by hand to my friends wall but not through the graph api?

EDIT: if I could tag a user in a video that would be the ideal solution.

You are not allowed to directly upload images/videos that are hosted on the fbcdn.net domain. This is a limitation that was put in place because the media was not always optimized. That is what this error means.

If you want to see how to upload a video to a user's wall see the How-To blog post https://developers.facebook.com/blog/post/532/ but in your case you may want to first download the video locally before uploading it via Graph API.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM