FBConnect: Send some images to someone's wall
I found out how to post a text on a user's wall using the FBConnect API on iphone. I even found how to post an image already online:
FBFeedDialog* dialog = [[[FBFeedDialog alloc] init] autorelease];
dialog.delegate = self;
dialog.templateBundleId = 12345;
dialog.templateData = @"{\"image\":[{\"src\":\"http://sample.png\",\"href\":\"http://sample.com\"}] }";
[dialog show];
(see http://wiki.developers.facebook.com/index.php/Facebook_Connect_for_iPhone )
But I can't figure out how to load UIImage from my iphone to custom wall using FB Api. I have, firstly, to upload an image to any website and then put its url in templateData strong>? Isn't there an easier solution?
Thank.
Martin
+2
source to share
2 answers
Use below function to load image, pass UIImage as parameter, it will work.
- (void)uploadPhoto:(UIImage *)uploadImage
{
NSMutableDictionary *args = [[[NSMutableDictionary alloc] init] autorelease];
[args setObject:uploadImage forKey:@"image"]; // 'images' is an array of 'UIImage' objects
[args setObject:@"4865751097970555873" forKey:@"aid"];// this should be album id
uploadPhotoRequest = [FBRequest requestWithDelegate:self];
[uploadPhotoRequest call:@"photos.upload" params:args];
NSLog(@"uploading image is successful");
}
+1
lakshmikanth
source
to share