我将此代码用于我的 facebook 请求,该请求将图像和文本发布到用户的提要:
我的问题是,如何添加位置参数?我遵循了本教程:https ://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/show-nearby-places/
但我无法使用后端服务器。如果我不想使用后端服务器,如何在不使用后端服务器的情况下修改我的代码以发布故事,包括位置(最好链接到 facebook 位置)?我让用户选择了这个地方,而且效果很好。目前,我有兴趣在不使用后端服务器的情况下让“at Patxi's Chicago Pizza”出现。这可能吗?
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:self.textViewForComments.text forKey:@"message"];
//DLog(@"%@",[params objectForKey:@"message"]);
if(self.capturedImageAtFullResolution){
DLog(@"not null");
[params setObject:UIImagePNGRepresentation(self.capturedImageAtFullResolution) forKey:@"picture"];
/*
if(canPostSmileysImage){ //##
//[params setObject:UIImagePNGRepresentation([self takeScreenShot]) forKey:@"picture"];
} else {
}
*/
[self performPublishAction:^{
[FBRequestConnection startWithGraphPath:@"me/photos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (error)
{
//showing an alert for failure
DLog(@"%@",error);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"unable to post"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
else
{
//showing an alert for success
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Posted!"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
}];
}];
}