1
下面的代碼successfuly後我在Facebook上牆上的文字,現在我想用下面的代碼如何使用圖形API將圖像和文本一起發佈?
- (IBAction)callFacebookAPI:(id)sender
{
[self.txtinputfield resignFirstResponder];
if (txtinputfield.text.length !=0)
{
//create the instance of graph api
objFBGraph = [[FbGraph alloc]initWithFbClientID:FbClientID];
//mark some permissions for your access token so that it knows what permissions it has
[objFBGraph authenticateUserWithCallbackObject:self andSelector:@selector(FBGraphResponse) andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins,publish_checkins,email"];
}
else
{
UIAlertView *objAlert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Kindly enter data in the text field" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[objAlert show];
}
}
- (void)FBGraphResponse
{
@try
{
if (objFBGraph.accessToken)
{
SBJSON *jsonparser = [[SBJSON alloc]init];
FbGraphResponse *fb_graph_response = [objFBGraph doGraphGet:@"me" withGetVars:nil];
NSString *resultString = [NSString stringWithString:fb_graph_response.htmlResponse];
NSDictionary *dict = [jsonparser objectWithString:resultString];
NSLog(@"Dict = %@",dict);
NSMutableDictionary *variable = [[NSMutableDictionary alloc]initWithCapacity:1];
[variable setObject:txtinputfield.text forKey:@"message"];
[objFBGraph doGraphPost:@"me/feed" withPostVars:variable];
UIAlertView *objAlert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"String posted on your wall and you may check the console now" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[objAlert show];
}
}
@catch (NSException *exception) {
UIAlertView *objALert = [[UIAlertView alloc]initWithTitle:@"Alert" message:[NSString stringWithFormat:@"Something bad happened due to %@",[exception reason]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[objALert show];
}
txtinputfield.text = clearText;
}
我嘗試了一些方法,但我did'nt工作與文字一起發佈的圖像,我有圖沒經驗API的任何幫助將appriated.Thanks
謝謝您的回答是我使用一些不同的邏輯穿上它。晚上我會在這裏發表我的答案並提供一些細節。 – jamil 2013-02-15 12:00:53