开发者

FBConnect - uploading images to Wall

开发者 https://www.devze.com 2022-12-28 18:38 出处:网络
i\'ve configured FBConnect and it uploads to the wall, but what i want to do is take a screenshot and then upload the screenshot to FB.

i've configured FBConnect and it uploads to the wall, but what i want to do is take a screenshot and then upload the screenshot to FB.

In the below code there is an image but as a url. Can i intersect this and put in my screenshot image?

 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/co开发者_开发技巧nnect.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];

}

i know all the code is default i haven't edited it yet incase i can't do what i want to do.

Cheers


Yes its possible with the new FB API nw, they made it as simple as possible

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

精彩评论

暂无评论...
验证码 换一张
取 消