objective c - how to share image on Facebook in iphone -
i'm facing problem in code. i'm using code:
//create uiimage (you use picture album or camera too) nsdata *imagedata = uiimagejpegrepresentation(imgview.image, 8.0); uiimage *picture = [uiimage imagewithdata:imagedata]; //create fbgraphfile object insance , set picture wish publish on fbgraphfile *graph_file = [[fbgraphfile alloc] initwithimage:picture]; //finally, set fbgraphfileobject onto our variables dictionary.... [variables setobject:graph_file forkey:@"file"]; [variables setobject:@"i'm testing iphone app" forkey:@"message"]; //the fbgraph object smart enough recognize binary image data inside fbgraphfile //object , treat such..... fbgraphresponse *fb_graph_response = [fbgraph dographpost:@"117795728310/photos" withpostvars:variables]; nslog(@"postpicturebuttonpressed: %@", fb_graph_response.htmlresponse); nslog(@"now log facebook , @ profile & photo albums..."); in code, exc_bad_access error message, image posted on facebook.
how can solve problem?
-(void)postinappfacebook { nsmutabledictionary *variables = [nsmutabledictionary dictionarywithcapacity:3]; uiimage *picture = filterimage; fbgraphfile *graph_file = [[fbgraphfile alloc] initwithimage:picture]; [variables setobject:graph_file forkey:@"file"]; [variables setobject:[nsstring stringwithformat:@"hello testin"] forkey:@"message"]; [fbgraph dographpost:@"me/photos" withpostvars:variables]; nslog(@"now log facebook , @ profile & photo albums..."); }
Comments
Post a Comment