Reputation: 424
While uploading image in facebook wall, image is not at all getting on the wall. I tried:
[[FBRequest requestWithDelegate:self] call:@"facebook.Users.setStatus" params:
params dataParam:UIImagePNGRepresentation(img)];
to no avail.
Upvotes: 0
Views: 184
Reputation: 424
Images will get into your photo Album and information about it on the wall.
NSMutableDictionary *params =[NSMutableDictionary dictionaryWithObjectsAndKeys:@"Testmessage", @"message", imageData, @"picture", nil];
[facebook requestWithGraphPath:@"/me/photos" andParams:params andHttpMethod:@"POST" andDelegate:self];
Upvotes: 0
Reputation: 1291
Try to do it using Sharekit.
Add Sharekit framework to your project.
Change the setting from shkconfig.h file.
pass the key which you can generate from facebook->developer->apps->create new app->generate keys pass it to shkconfig.h
-(IBAction) tryItOnFb:(id)sender
{
SHKItem *item = [SHKItem image:[UIImage imageNamed:@"YES.png"]title:@"FB Test"];
[NSClassFromString(@"SHKFacebook") performSelector:@selector(shareItem:) withObject:item];
}
Upvotes: 0
Reputation: 4170
Using sharekit you can try following code:
-(IBAction)btnSendToFacebookPressed:(id)sender
{
NSString *var = [[NSUserDefaults standardUserDefaults] valueForKey:@"IMAGE_INDEX"];//This line may not be useful to you...
NSString *imageIndex = [[NSBundle mainBundle] pathForResource:var ofType:@"jpg"];
SHKItem *item = [SHKItem image:[UIImage imageWithContentsOfFile:imageIndex] title:@"Your Title"];
[NSClassFromString(@"SHKFacebook") performSelector:@selector(shareItem:) withObject:item];
}
Upvotes: 0
Reputation: 901
You can do it using Sharekit....
Try this code...
-(void)shareOnFacebook {
//take screenshot
UIImage *image = "Your image";
//for debug purpose the image can be stored to photo album
//UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
SHKItem *fbItem = [SHKItem image:image title:@"Check out my Image!"];
[SHKFacebook shareItem:fbItem];
}
Upvotes: 1