Can I upload video to Facebook from within an iPhone application? - iphone

In the past, I've been able to upload images and text to Facebook from within my iPhone application, but I have not been able to upload video. Does anyone know how to programmatically upload video to Facebook?

You appear to be able to make a facebook.video.upload FBRequest call, similar to how photos are uploaded.

Here is sample for photo upload, I guess similar with video, but seems like more limitation for video.
UIImage *img1 = [UIImage imageNamed:#"me.png"];
NSMutableDictionary * params1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img1, #"picture",
nil];
[_facebook requestWithMethodName: #"photos.upload"
andParams: params1
andHttpMethod: #"POST"
andDelegate: self];

Working implementation using TheRonin's answer and the link to Zoul's code on Github can be found here.

Related

share video on Facebook from iPhone App

How do I share video link (video(.mov format) is on server and want to share link of it through my iPhone app)??
I am able to to send the link of the video and send an image along with it.
But when I click on the link the video is playing in the other page.
All I want is that the video is played on the same page and my image should act as thumbnail image.
I was able to get it to work with facebook dialog using the following parameters:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
title, #"name",
caption, #"caption",
description, #"description",
itemLink, #"link",
source, #"source",
thumbnailURL, #"picture",
#"video", #"type",
nil];
The source is the embedded video source+player and the link is where the user will go if they click on your title (e.g. the video on your webpage).

facebook dialog feed custom picture from your app instead of an url

Is it possible to encode a picture from our iPhone to use with facebook dialog feed instead of passing an URL.. !
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Blablabla", #"name",
#"Blablabla", #"caption",
#"Blablabla", #"description",
#"http://google.com", #"link",
#"HTTP:CAN IT BE AN ENCODED PICTURE??", #"picture",
actionLinksStr, #"actions",
nil];
[facebook dialog:#"feed" andParams:params andDelegate:self];
There's a reference link for params:
http://developers.facebook.com/docs/reference/api/post/
I've been stuck at the same problem and was quite shocked that there's no support for uploading images. My solution was to upload the picture to my remote web server and use the link that I've got from server.
I'm uploading to Amazon s3 then using that url to post to the feed.

Facebook iPhone like iTunes app will load an incorrect image

In my iPhone application I have a feature that lets users share my application on their facebook accounts, I use the following code to archive this:
faceBook = [[Facebook alloc] initWithAppId:#"xxxxxxxxxxxx"];
[faceBook authorize:nil delegate:self];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[#"iTunes AppStore URL", #"link",
nil];
[faceBook dialog:#"feed" andParams:params andDelegate:self];
}
I have several iPhone applications already available on the iTunes AppStore, and when I use the above function Facebook use SSO and shows a view to the user to Post, but the large image on the left side is incorrect, instead of the correct logo I get the logo of the first Application I posted on the AppStore.
I have setup the Facebook App correctly with the icon and the logo. this question is related to the following iphone posting link to facebook wall - image

iOS SDK posting a link & displaying a thumbnail

I've managed to get the Facebook iOS SDK implemented into my project quite nicely with the assistance of the provided FB documentation.
My app's FB integration is quite simple: A Facebook share button, which allows a user to post a link to their FB wall with a user-supplied comment. Nothing earth-shattering or ground breaking.
However, I would like to go one step further. I don't have a thumbnail to display for the link (i.e. my own image URL), but I would like the thumbnail to be automatically selected by Facebook.
Similar to how, from Facebook in a web browser, if you choose to Share a link from CNN.com, Facebook will automatically select thumbnails for the desired page to be shared, AND it even gives you the option to checkbox "no thumbnail".
From the iOS dialog to share the link, I would like the thumbnail to automatically be selected (presumably it's generated from the link that you're trying to share, i.e. FB just grabs images from the page).
Is this possible? Again, I do not want to display "picture" with a supplied image URL in the 'attachment' NSDictionary below because I won't have the image URL. I just want to display a hyperlink and have FB post the link on the user's wall with their comment and have FB supply the thumbnail image (similar to how it would if you posted from a web browser).
Basically the code from Stack Overflow is:
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary
dictionaryWithObjectsAndKeys: #"Always Running", #"text", #"http://itsti.me/", #"href",
nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
#"a long run", #"name",
#"The Facebook Running app", #"caption",
#"it is fun", #"description",
#"http://itsti.me/", #"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Share on Facebook", #"user_message_prompt",
actionLinksStr, #"action_links",
attachmentStr, #"attachment",
nil];
[_facebook dialog:#"stream.publish" andParams:params andDelegate:self];
A different approach to this would be to call the Graph API instead of using a dialog. So if you make an HTTP POST to https://graph.facebook.com/me/feed and supply the message and link parameters the image should be automatically selected by Facebook. See https://developers.facebook.com/docs/reference/api/user/#links.
You will have to generate the UI to ask the user to enter the message. If that can work for you then this is the way to go.
I don't think you have to post a picture. Also, what Facebook is doing is getting Open Graph tags (meta tags in the beginning of web documents just for this purpose). You should be able to simply post a link and a message, and it will "lint"- read the meta tags and post the picture, summary, etc. for that web page.
You may try using Open Graph graph actions instead of share dialogs. It will do more of what you want.http://developers.facebook.com/docs/opengraph/

How to post both text, image and link at once on friends' walls via facebook API

How to let someone post on his/her friends' walls via facebook API, similar to instagr.am iPhone application lets you post on your own wall?
How to show a list of friends and allow selecting them?
How to post both text, image and link at once?
As it happens, Facebook has an iOS SDK available, and instructions on how to use that to post feed items (either with an interactive dialog, or with their Graph API).
i did this way. it works fine.. u can post for multiple frnds as well.
NSMutableDictionary* params1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
<appId>, #"api_key",
#"Happy Birthday....", #"message",
#"http://www.youtube.com/watch?v=wFh-rX_Sfhs", #"link",
#"http://www.99desi.com/wp-content/uploads/2011/03/Happy-Birthday.jpg", #"picture",
#"Many More Happy returns Of the Day...", #"name",
#" Believing hear, what you deserve to hear..", #"description",nil];
[facebook requestWithGraphPath:#"<frnd-ID>/feed" andParams:params1 andHttpMethod:#"POST" andDelegate:self];
u can iterate the above step to post same to multi friends.
hope it helps you...