将带有标题的图像上传到Facebook的框架

时间:2012-03-13 20:40:30

标签: iphone ios xcode

我在互联网代码中看到上传图片但使用“Facebook”无法识别,那么我需要在iOS中使用哪个框架? 你有代码示例吗? 我找到了这段代码:

- (IBAction)uploadPhoto:(id)sender {
    NSString *path = @"http://www.facebook.com/images/devsite/iphone_connect_btn.jpg";
    NSURL *url = [NSURL URLWithString:path];
    NSData *data = [NSData dataWithContentsOfURL:url];
    UIImage *img = [[UIImage alloc] initWithData:data];

    NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:img, @"picture", @"my photo's caption text here.", @"message", nil];
    [facebook requestWithMethodName: @"photos.upload" andParams:params andHttpMethod:@"POST" andDelegate:self];
    [img release];
}

1 个答案:

答案 0 :(得分:0)

您需要将Facebook iOS SDK添加到您的项目中。

您应该找到所需的所有详细信息here

相关问题