-1

After searching 2 days on it m finally posting my code.

Application Description: I am choosing an image through imagePicker and after editing it I want to share it on Facebook.

Problem: I can post the text on my wall but not the image, as i dont have any URL i cant find another way to post image on my wall.

here is the code ( which i stole from another application) of my PostToWall

FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.userMessagePrompt = @"Enter your message:";
dialog.actionLinks = @"[{\"Get DowntownLA!\",\"href\":\"http://www.facebook.com/DowntownLA.com/\"}]";
dialog.attachment = [NSString stringWithFormat:
                     @"{ \"name\":\"%@\","
                     "\"href\":\"%@\","
                     "\"caption\":\"%@\",\"description\":\"%@\","
                     "\"media\":[{\"type\":\"image\","
                     "\"src\":\"%@\","
                     "\"href\":\"%@\"}],"
                     "\"properties\":{\"%@\":{\"text\":\"%@\",\"href\":\"%@\"}}}", @"name: priya",@"href nothing",@"cation nothing",@"description nothin", @"imageSource nothing ", @"imageHref nothing", @"linkTitle nothing", @"linkText nothing", @"linkHref nothing"];


[dialog show];

Please tel me wher m going wrong !!!!!

The error m getting on simulator is : Application Response Error - The post action links must be valid URls. You can see this because you are one of the developers of the app.

user102008
  • 30,736
  • 10
  • 83
  • 104
Iphone Developer
  • 163
  • 2
  • 14

1 Answers1

0

i have upload image in this way

- (void) postOnFBWall

{

NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:2];

//create a UIImage (you could use the picture album or camera too)
UIImage *picture = imgUploadPhoto.image;

//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"];

NSString * messageValue = [NSString stringWithFormat:@"Menu Name: %@, Restaurant: %@, Category: %@, Comment: %@",txtNameofMenu.text,txtRestaurant.text,categoryLbl.text,txtViewComment.text];

[variables setObject:[NSString stringWithFormat:@"%@",messageValue] 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 = [[FBRequestWrapper defaultManager] doGraphPost:@"me/photos" withPostVars:variables];
NSLog(@"postPictureButtonPressed:  %@", fb_graph_response.htmlResponse);

}

Droid
  • 1,091
  • 2
  • 9
  • 14
  • I am unable to include FbGraphFile. Igot 6 errors, : error: 'FbGraphFile' undeclared (first use in this function) error: 'graph_file' undeclared (first use in this function) error: 'messageValue' undeclared (first use in this function) error: 'FbGraphResponse' undeclared (first use in this function) error: 'fb_graph_response' undeclared (first use in this function) error: 'FBRequestWrapper' undeclared (first use in this function) – Iphone Developer Aug 29 '11 at 14:08