[英]SLComposeViewController issue in iOS9
I want to share image,url and text to facebook and I am not able to make it work on iOS9.Here is my code. 我想将图像,URL和文本共享到Facebook,但我无法使其在iOS9上正常工作。这是我的代码。
-(IBAction)shareOnFacebook:(id)sender{
UIButton *btn = (UIButton *)sender;
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:SHARING_QUOTE_D(self.dish.name, self.dish.restaurant.name)];
[controller addURL:[NSURL URLWithString:SHARING_URL]];
[controller addImage:self.dishImageView.image];
[self presentViewController:controller animated:YES completion:Nil];
if ([controller respondsToSelector:@selector(popoverPresentationController)])
{
UIPopoverPresentationController *presentationController = [controller popoverPresentationController];
presentationController.sourceView = btn; // if button or change to self.view.
}
}else{
[[[UIAlertView alloc] initWithTitle:@"Error Message" message:@"Please log into your Facebook account to post" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil] show];
}
}
You must use New Facebook SDK for sharing. 您必须使用New Facebook SDK进行共享。 Also you want Facebook app in the device.
另外,您还希望设备中使用Facebook应用程序。 The iOS 9 will dismiss the SLComposeView and may be show you alert "....not supported..."
iOS 9将关闭SLComposeView,并可能显示警告“ ....不支持...”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.