Share screenshot on Facebook

旧巷老猫 提交于 2019-12-04 18:13:15

Well, you can use the iOS6 built-in Facebook integration. Include the Social framwork in Build Phases The code should look bi similar to this snipped:

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]){
    mySLComposerSheet = [[SLComposeViewController alloc] init];
    mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
    [mySLComposerSheet setInitialText:@"Some Text"];
    [mySLComposerSheet addImage:[self captureView:self.view]];
    [self presentViewController:mySLComposerSheet animated:YES completion:nil];
}

*Note this will not "automatically" share the screenshot but it will attach it to a Facebook Compose Sheet and the user can post it if he/she wants to. To do it automatically, you will need to do a deeper Facebook integration and the user should give permission for your app to post on his/her wall. This again should be done with the Social framework or ShareKit if the project Deployment target is bellow iOS 6.0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!