我正在使用上一个问题发布的代码段,即将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不可用”,我怎么可能做错了?
我查看了可用的教程,并包括了所需的库,因此我不确定我在做什么错。
在Settings.app/Facebook中,您需要设置一个帐户。SLComposeViewController
如果您有帐户,则仅允许您在FaceBook上发帖。那是正常的行为,这就是FaceBook的工作方式:没有帐户,无所事事。
从iOS6开始,您可以在iOS中输入您的帐户,从而允许应用程序在某些iOS框架中使用此帐户,而无需导入Facebook SDK。当然,对于Social.framework,您几乎没有选择,而如果您想做更多事情(如时间表等),则必须使用FaceBook SDK。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句