jamil
jamil

Reputation: 2437

How to Post an Image to facebook wall?

Using this Tutorail i scceessfully login to Facebook http://www.raywenderlich.com/1626/how-to-post-to-a-users-wall-upload-photos-and-add-a-like-button-from-your-iphone-app But i have NO Experience with facebook for iOS .

- (IBAction)rateTapped:(id)sender {
     NSURL *url = [NSURL URLWithString:@"YOur Image url"];
     NSData *data = [NSData dataWithContentsOfURL:url];
     UIImage *img  = [[UIImage alloc] initWithData:data];
     [variables setObject:img forKey:@"picture"];
     FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"/me/photos" 
    withPostVars:variables];    
  }

But here i confused that how we can pass image url ,bcz my image is on the same page And also when i use this code its gives me following four Errrors.

enter image description here

I have no luck. What's wrong? Thanks in advance

Upvotes: 0

Views: 423

Answers (2)

TheTiger
TheTiger

Reputation: 13354

Please see this post - How to share or post by mail, twitter and facebook from the current application? In this you will found How to share an UIImage to Facebook, Twitter, and Email.

Upvotes: 1

Midhun MP
Midhun MP

Reputation: 107121

1st error is due to an *undeclared variable.* You are not added Facebook sdk to your project, that's why you are getting 2,3 & 4th errors. For using Facebook features in your application you need to integrate Facebook API to your project. The latest face book API is known as Graph API. For further reference visit http://developers.facebook.com/docs/reference/api/

How to integrate Facebook sdk to your project: http://www.raywenderlich.com/77/how-to-post-on-facebook-with-your-iphone-app

Upvotes: 0

Related Questions