在Facebook墙上添加照片

时间:2010-09-25 13:20:40

标签: iphone objective-c ios4

- (void)postToWall {
FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];

dialog.userMessagePrompt = [NSString stringWithFormat: subjectTitle]; //subjectTitle works here but not as name where i need it.

NSString *src = @"http://www.sample.com/image.png";
NSString *name = storyLink;  //<---------------------------------works with storyLink but not subjectTitle. I need subjectTitle to work here
NSString *href = storyLink;

NSString *attachment = [NSString stringWithFormat:@"{\"name\":\"%@\",\"media\":[{\"type\":\"image\", \"src\":\"%@\", \"href\":\"%@\"}]}", name, src, href];
dialog.attachment = attachment;
[dialog show]; 
}

我想将照片库中的图片而不是http://www.sample.com/image.png添加到脸谱墙。

任何人都可以为我提供帮助....

提前致谢......

2 个答案:

答案 0 :(得分:1)

您可以使用UIImagePickerController及其委托方法访问iPhoto图库项目的URL。

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

当用户选择照片时,该网址将位于密钥UIImagePickerControllerMediaURL

下的字典中

答案 1 :(得分:1)

可能这Stack Overflow Question about uploading images to Facebook可能对您有所帮助。

此外,Sharekit是一个很好的框架,可以为您的iPhone App添加社交功能。我认为它有共享图像的功能。您可以在Sharekit official website查看。