我开发了一个示例项目,其中显示文本和图像,我可以将它发布到Facebook墙上。我已经表明了代码和它下面的图像。这看起来像我们如何将照片添加到我们的墙状态消息如何在不使用开放图形API的情况下在Facebook墙上发布图像和文本
- (IBAction)postStatusUpdateClick:(UIButton *)sender
{
UIImage *image =[UIImage imageNamed:@"[email protected]"];
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。谁能帮我在这
感谢
我已经做了这样..现在我想要做像我有我的问题出在图像2 – raptor 2013-04-11 03:28:22
不知道,如果你可以在没有Open Graph API的情况下完成这些小事。 – 2013-04-11 12:13:00
您是否知道如何使用开放图API来实现它? – raptor 2013-04-11 16:49:12