[英]How to post image and text on facebook wall without using open graph API
我开发了一个示例项目,我正在显示文本和图像,我可以在Facebook墙上发布它。 我已经在下面展示了它的代码和图像。这看起来就像我们如何通过状态信息将照片添加到我们的墙上
- (IBAction)postStatusUpdateClick:(UIButton *)sender
{
UIImage *image =[UIImage imageNamed:@"Icon-72@2x.png"];
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:@"Test with Image" forKey:@"message"];
[params setObject:UIImagePNGRepresentation(image) forKey:@"picture"];
shareOnFacebook.enabled = NO; //for not allowing multiple hits
[FBRequestConnection startWithGraphPath:@"me/photos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (error)
{
//showing an alert for failure
[self showAlert:@"Facebook unable to share photo " result:result error:error];
}
else
{
//showing an alert for success
[self showAlert:@"Facebook share photo successful" result:result error:error];
}
shareOnFacebook.enabled = YES;
}];
}
// UIAlertView helper for post buttons
- (void)showAlert:(NSString *)message
result:(id)result
error:(NSError *)error {
NSString *alertMsg;
NSString *alertTitle;
if (error) {
alertTitle = @"Error";
if (error.fberrorShouldNotifyUser ||
error.fberrorCategory == FBErrorCategoryPermissions ||
error.fberrorCategory == FBErrorCategoryAuthenticationReopenSession) {
alertMsg = error.fberrorUserMessage;
} else {
alertMsg = @"Operation failed due to a connection problem, retry later.";
}
} else {
NSDictionary *resultDict = (NSDictionary *)result;
alertMsg = [NSString stringWithFormat:@"Successfully posted '%@'.\nPost ID: %@",
message, [resultDict valueForKey:@"id"]];
alertTitle = @"Success";
}
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:alertTitle
message:alertMsg
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
*****现在我希望以适当的格式显示,例如来自Facebook的美味示例。**
我想在没有开放图形api的情况下做到这一点。 任何人都可以帮助我
谢谢
在FB Wall上使用文本发布图像而不使用Open Graph API >> http://xcodenoobies.blogspot.com.au/2012/09/how-to-upload-photo-and-update-status.html
更新的答案
使用FB iOS SDK在Facebook上发布图像和文本https://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/
干杯,拉维
只需在移动safari中打开此URL。它将显示共享对话框
"http://www.facebook.com/dialog/feed?fbapp_id=yorfbappId&name=Test&description=test&redirect_uri=fbyourfbappid%3A%2F%2Fauthorize&sdk=ios"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.