我正在使用以下方法将照片发布到 Facebook。它工作正常,但是图像设置如下: NSURL *url = [NSURL URLWithString:@"http://www.example.com/image.png"];
我想让用户从他们的 iPhone 相机文件夹中选择图像。我将如何执行此操作 - 从相册中检索图像并通过此方法发送?
谢谢你的帮助
- (void)apiGraphUserPhotosPost {
[self showActivityIndicator];
currentAPICall = kAPIGraphUserPhotosPost;
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
// Download a sample photo
NSURL *url = [NSURL URLWithString:@"http://www.example.com/image.png"];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
[img release];
[[delegate facebook] requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
}