Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BarryK88

macrumors member
Original poster
Mar 1, 2011
31
0
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

Code:

Code:
UIGraphicsBeginImageContext(self.view.bounds.size);
            [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
            UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
            UIGraphicsEndImageContext();

            UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

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

Code:

Code:
- (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!
 

dantastic

macrumors 6502a
Jan 21, 2011
572
678
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.