我正在使用我之前的问题中发布的代码片段,将 Facebook/Twitter 共享添加到应用程序的简单方法?
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[slComposeViewController setInitialText:@"Your text"];
[slComposeViewController addImage:[UIImage imageNamed:@"NameOfImage"]];
[self presentViewController:slComposeViewController animated:YES completion:nil];
} else {
//Show alert or in some way handle the fact that the device does not support this //feature
NSLog(@"Facebook not available");
}
但是当我在设备和模拟器上运行它时,我得到的只是“Facebook 不可用”,我做错了什么?
我查看了可用的教程,并且包含了所需的库,所以我不确定我做错了什么。