Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upload image on facebook ios

Tags:

iphone

please help me to upload image on facebook using iphone app.here i dont have the url.i just only have the image.but i cant upload it on face book.if i can use an url then i can simply upload it.please help me.

please send me the code for upload image. i already create facebook instance and other codes relative to fbconnect ios.

like image 755
lara1435 Avatar asked Mar 30 '11 15:03

lara1435


People also ask

Why can't I upload photos to Facebook from my iPhone?

Make sure you've downloaded the most recent version of the Facebook app. You can also try to close and restart the app. Restart or update your mobile device: Make sure you're using the most recent version of the operating system for your mobile device.

Why can't I add pictures to my Facebook post?

I can't upload photos on FacebookMake sure that you have a strong Wi-Fi or network connection. Try uploading the original photo instead of an edited version. Check the size of the photo. We recommend uploading photos under 15MB.


1 Answers

The DemoApp that comes with the facebook ios api contains the code to upload a photo in the sample:

https://github.com/facebook/facebook-ios-sdk/tree/master/sample/DemoApp

/**
 * Upload a photo.
 */
- (IBAction)uploadPhoto:(id)sender {
  NSString *path = @"http://www.facebook.com/images/devsite/iphone_connect_btn.jpg";
  NSURL *url = [NSURL URLWithString:path];
  NSData *data = [NSData dataWithContentsOfURL:url];
  UIImage *img  = [[UIImage alloc] initWithData:data];

  NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 img, @"picture",
                                 nil];
  [_facebook requestWithMethodName:@"photos.upload"
                         andParams:params
                     andHttpMethod:@"POST"
                       andDelegate:self];
  [img release];
}
like image 60
Bastian Avatar answered Sep 27 '22 22:09

Bastian