how to retrieve photos from Facebook - iphone

i have tied lot to get the uploaded images fom the facebok to a UITableviewcontroller,but i get the profile picture only.i have a image cropping application which can get images from library,from camera,fromfacebook.so when the user tap the Facebook button,it will authenticate and if the authentication success,it will strive the photos from Facebook to UITableview.Is that possible if yes how to do this.
I do have this code:
NSString *url = [[NSString alloc] initWithFormat:#"graph.facebook.com/%#/picture",objectId];
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]];
But I'm not sure What is objectID and where can i get it?
Please help me.Thanks in advance.

First you have to get album objects.
How to do that is here: fetching facebook albums from an IOS app
Once you have album objects - each of them contains array of photo objetcs (IDs).
Please take a look at deanWombourne's answer at How to get photos of a facebook album in iPhone SDK?.
And from there on your code should work just fine.

Related

upload image to facebook wall after posting it to photos using sharekit 2.0

I'm trying to post image to facebook photos using sharekit:
SHKItem *item = [SHKItem image:image_ title:#""];
[SHKFacebook shareItem:item];
Everything works fine but normally when you post photo using facebook website information is posted on faceook's wall also. When I post my photo using sharekit it doesn't happen. How can I achieve this?

Facebook URL Scheme for iOS - post photo

There are many URL schemes that can be used for facebook on iOS.
Is it possible to use one of these URL schemes to post a photo to a fan page?
I was trying to use fb://publish/photo/(initWithUID:)/(aid:)/(pid:) and fb://upload/(initWithSource:)/profile/(uid:) without any luck.
I'm not sure what to use for the initWithSource:.
Has anyone had any success in doing this?
You can use ShareKit framework to share the images to Facebook.
All you need to do is simple as following.
SHKItem *item = [SHKItem image:myImage title:#"Title"];
SHKFacebook *sharer = [[[SHKFacebook alloc] init] autorelease];
[sharer loadItem:item];
[sharer share];
ShareKit is very useful and easy to use.
You can get some idea from here and then merge this code in your own code as per on your requirement Post Photos on fan page

Facebook Graph post image to page

I can succesfuly upload pictures to my own wall by posting an image to https://graph.facebook.com/me/photos. Now i need to post to a page's wall instead. I have the page ID, but when i change "me" in the url to the pages ID, the image is still posted to my own wall instead of the page's. How do i post an image to a page's stream?
And which permissions is required to do so?
It would be great if you guys could help me out, has got stuck on this one. Thank you!
You cannot upload pictures to wall (it's uploading to album).
To upload picture to Page's Album you need to use page access_token that is accessible via accounts connection of user (you'll need manage_pages permission to get this info).
Once you have access_token for page you may upload picture in the same way as you do for user but using page id instead of user id (you will need publish_stream permission for user to post content pages he own).
m_imgData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForAuxiliaryExecutable:#"Default.png"]];
NSMutableDictionary *fbArguments = [[[NSMutableDictionary alloc] init] autorelease];
[fbArguments setObject:self.m_imgData forKey:#"source"];
[fbArguments setObject:#"Uploading images" forKey:#"message"];
[m_facebook requestWithGraphPath:#"Page_ID/photos"
andParams:fbArguments
andHttpMethod:#"POST"
andDelegate:self];
Where i am using Default.png as a image to upload.
m_facebook is allocated object of Class Facebook (Provided as a part of Facebook SDK).
m_imageData is an object of NSData.

IOS Post Photo To Facebook Without The Facebook Connect-Api

Is it possible to post a photo to a Facebook Page wall without using the Facebook connect Api?
To post some text I tried using this:
NSString *post = [NSString stringWithFormat:#"fb://publish/profile/1111111111112311?text=%#",#"some text here"];
NSURL *url = [NSURL URLWithString:post];
thanks
To do this, I would suggest using Sharekit. ShareKit is a free api that allows you to intregrate many sharing feastures for many services, with minimal code (less than 20 lines).
Here is a link to get ShareKit: getsharekit.com
To share a photo on Facebook with Sharekit, do this:
Add sharekit to your project by coping the files found at the link above
Use the following code to set up the share instance:
UIImage *image = [UIImage imageNamed:#"someImage.jpg"];
SHKItem *item = [SHKItem image:image title:#"Look at this picture!"];
Then just share the image with this:
[SHKFacebook shareItem:item];
However, the newest Facebook API is actually pretty easy to use. And it's very well documented, so you might want to check it out. There are some benefits to using Facebook's actually API, rather then use a proxy service.

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

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.