在iphone的facebook墙上共享图像和文本不起作用?

在iphone的facebook墙上共享图像和文本不起作用?,iphone,objective-c,ios,facebook,Iphone,Objective C,Ios,Facebook,大家好,我想在iphone中直接分享图像,同时分享文本。 我在单击按钮时实现了以下代码,但它什么也没做… NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4]; [variables setObject:[NSString stringWithFormat:@"Hi... Testing APp"] forKey:@"message"]; [variables setObje

大家好,我想在iphone中直接分享图像,同时分享文本。 我在单击按钮时实现了以下代码,但它什么也没做…

     NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];

 [variables setObject:[NSString stringWithFormat:@"Hi... Testing APp"] forKey:@"message"];
 [variables setObject:@"http://icon.png" forKey:@"picture"];       //http://tinyurl.com/45xy4kw
 [variables setObject:@"Create post" forKey:@"name"];
 [variables setObject:@"Write description." forKey:@"description"];

 [facebook requestWithGraphPath:@"/me/feed" andParams:variables andHttpMethod:@"POST" andDelegate:self]; 
我正在为此使用facebook direct api

您可以使用此代码发布图像。请尝试此代码一次

-(IBAction)postPictureButtonPressed:(id)sender 
  {
     NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:2];

     UIImage *picture = [UIImage imageNamed:@"75x75.png"];

     FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture];

     [variables setObject:graph_file forKey:@"file"];

     [variables setObject:@"this is a test message: postPictureButtonPressed" forKey:@"message"];

     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...");

   }    

使用此代码工作正常

-(IBAction)postMeFeedButtonPressed:(id)sender {

    NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:8];


    //create a UIImage (you could use the picture album or camera too)
    UIImage *picture = [UIImage imageNamed:@"Icon@2x.png"];

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

    NSArray *idarry=[[NSArray alloc]initWithArray:Delegate.IdListArray];
    NSLog(@"Delegate array %@",Delegate.IdListArray);

    //NSString *str=[NSString stringWithFormat:@"100001912715296,100001912715296"];
    NSString *str=[idarry componentsJoinedByString:@","];

    NSLog(@"The string contents are %@",str);

   NSString *idstr=[NSString stringWithFormat:@"100002875785051,100001912715296"];

    [variables setObject:idstr forKey:@"tags"];
    [variables setObject:@"110506962309835" forKey:@"place"];

    [variables setObject:@"Hello All my dear friends,I am using MySafety APP" forKey:@"message"];
    [variables setObject:@"http://techilasolutions.com/product.html" forKey:@"link"];
    [variables setObject:@"My Safety" forKey:@"name"];
    [variables setObject:@"http://techilasolutions.com/images/car_tag.png" forKey:@"picture"];
    [variables setObject:@"This is a must have app for all women whether you are a working lady, a house wife or a school going girl.This app lets you save 6 emergency contacts whom you want to alert in case of emergency.Whenever you feel you are in danger, just press the SOS button and it will send sms to your contacts with your current location and a alarm will go on with flashing lights" forKey:@"description"];

    FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"me/feed" withPostVars:variables];
    NSLog(@"postMeFeedButtonPressed:  %@", fb_graph_response.htmlResponse);

    //parse our json
    SBJSON *parser = [[SBJSON alloc] init];
    NSDictionary *facebook_response = [parser objectWithString:fb_graph_response.htmlResponse error:nil];
    [parser release];

    //let's save the 'id' Facebook gives us so we can delete it if the user presses the 'delete /me/feed button'
    self.feedPostId = (NSString *)[facebook_response objectForKey:@"id"];
    NSLog(@"feedPostId, %@", feedPostId);
    NSLog(@"Now log into Facebook and look at your profile...");

}

FbGraphResponse*fb_graph_response=[fbGraph doGraphPost:@“me/feed”,带postVars:variables];删除“/”之前,我已经尝试过这也不工作,我不知道wt是问题所在。。。!是否添加FB Graph Api文件夹。否,我不想添加任何Api!我只需要实现直接的facebook api。。