1

我已经配置了 FBConnect,它会上传到墙上,但我想做的是截图,然后将截图上传到 FB。

在下面的代码中有一个图像,但作为一个 url。我可以相交这个并放入我的截图图像吗?

 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];

}

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

干杯

4

1 回答 1

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];
于 2011-08-07T06:33:17.807 回答