gpt4 book ai didi

iphone - 如何在不使用开放图谱API的情况下在Facebook墙上发布图像和文本

转载 作者:行者123 更新时间:2023-12-01 19:12:04 29 4
gpt4 key购买 nike

我已经开发了一个示例项目,在其中显示“文本”和“图像”,并能够将其发布到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的情况下进行操作。有人可以帮我这个

谢谢

最佳答案

在不使用Open Graph API的情况下在FB墙上发布带有文本的图像>> 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/

干杯,
拉维

关于iphone - 如何在不使用开放图谱API的情况下在Facebook墙上发布图像和文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15910542/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com