FBConnect - 将图像上传到Wall

时间:2010-05-03 11:44:30

标签: iphone fbconnect

我已经配置了FBConnect并将其上传到墙上,但我要做的是截取屏幕截图,然后将屏幕截图上传到FB。

在下面的代码中有一个图像,但作为网址。我可以将其交叉并放入我的截图图片吗?

 FBStreamDialog *dialog = [[[FBStreamDialog alloc] init]autorelease];
             dialog.userMessagePrompt = @"Tell your friends about Fridgit!!:";
             dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"Facebook Connect for iPhone\",\"href\":\"http://developers.facebook.com/connect.phptab=iphone\",\"caption\":\"Caption\",\"description\":\"Description\",\"media\":[{\"type\":\"image\",\"src\":\"screenShot\",\"href\":\"http://developers.facebook.com/connect.php?tab=iphone/\"}],\"properties\":{\"another link\":{\"text\":\"Facebook home page\",\"href\":\"http://www.facebook.com\"}}}", self.screenShot];                
 [dialog show];

}

我知道所有的代码都是默认的我还没有编辑它,但是我不能做我想做的事。

干杯

1 个答案:

答案 0 :(得分:0)

是的,可以使用新的FB API nw,它们使它尽可能简单

// code snippet to take a snapshot
// REF: http://stackoverflow.com/questions/2200736/how-to-take-a-screenshot-programmatically

UIGraphicsBeginImageContext(self.window.bounds.size);
    [self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   img, @"picture",
                                   nil];

    [_facebook requestWithGraphPath:@"me/photos"
                          andParams:params
                      andHttpMethod:@"POST"
                        andDelegate:self];
相关问题