Search code examples
iphoneiosxcodefb-graph

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


Solution

  • 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.