使用SLComposeViewController将图像发布到facebook的特定相册中

时间:2014-04-13 00:57:35

标签: ios facebook facebook-graph-api cocos2d-iphone slcomposeviewcontroller

我正在使用以下代码在Facebook上发布图片

-(void) facebookShare: (id) sender
{
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
    {
        SLComposeViewController *facebookSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
        CCScene *myScene = [[CCDirector sharedDirector] runningScene];
        CCNode *node = [myScene.children objectAtIndex:0];
        [facebookSheet addImage: [GameOverLayer screenshotWithStartNode:node]];
        [facebookSheet setInitialText:[NSString stringWithFormat:@"I just scored %d in an awesome game of XXX", scoreNum]];
        [[CCDirector sharedDirector] presentViewController:facebookSheet animated:YES completion:nil];
    }
    else
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Please login to Facebook to share your score!" delegate: self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Login",nil];
        [alert show];
    }    
}

代码工作正常,但我想知道如何为游戏创建特定的专辑,并将图像发布到该专辑?谢谢!

0 个答案:

没有答案