I found out how to send some text on the user's wall, with the FBConnect API, on iphone. I even found how to put an image already on the internet :
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 upload an UIImage from my iphone to the user's wall with FB Api. Do I have, first, to upload the image on any website, then put its url in the templateData ? Isn't there any simpler solution ?
Thanks.
Martin
Use the below function to upload the image, pass the UIImage as the 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");
}