View Full Version : How to take a screenshot in your App and publish it on facebook?

Jun 6, 2011, 09:22 AM
I'm trying to use facebook within my App by posting a screenshot of my App on my wall.

I already made the functions for taking a screenshot


[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

and for posting stuff on my facebook wall with an icon, title and small description.


- (void)postToWall {

FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.userMessagePrompt = @"Enter your message:";
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@ share's a photo\",\"href\":\"mywebsite.com/\",\"caption\":\"%@thinks this is a nice photo\",\"description\":\"\",\"media\":[{\"type\":\"image\",\"src\":\"mywebsite.com/icon.png\",\"href\":\"mywebsite.com/\"}]}",
_facebookName, _facebookName];

dialog.actionLinks = @"[{\"text\":\"Get My App\",\"href\":\"http://itunes.apple.com//\"}]";

Any suggestions of how to put my screenshot within the postToWall method? Thanks in advance!

Jun 6, 2011, 11:18 AM
Will you please stop posting the same questions in multiple forums.

Is that not part of the facebook demo app btw? could have sworn I saw "post a photo" when I was looking at that.