I’m facing a problem in my code. I’m using this code:
//create a UIImage (you could use the picture album or camera too)
NSData *imageData = UIImageJPEGRepresentation(imgView.image, 8.0);
UIImage *picture = [UIImage imageWithData:imageData];
//create a FbGraphFile object insance and set the picture we wish to publish on it
FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture];
//finally, set the FbGraphFileobject onto our variables dictionary....
[variables setObject:graph_file forKey:@"file"];
[variables setObject:@"i'm testing my iPhone App" forKey:@"message"];
//the fbGraph object is smart enough to recognize the binary image data inside the FbGraphFile
//object and treat that is such.....
FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"117795728310/photos" withPostVars:variables];
NSLog(@"postPictureButtonPressed: %@", fb_graph_response.htmlResponse);
NSLog(@"Now log into Facebook and look at your profile & photo albums...");
In this code, I get the EXC_BAD_ACCESS error message, but the image is posted on Facebook.
How can I solve this problem?
1 Answer