SLComposeViewController在iOS 8的Facebook上共享时自动关闭
我正在我的应用程序中使用SLComposeViewController在Twitter和Facebook上共享。它在Twitter上运行良好,但在Facebook上,SLComposeViewController会在选择位置时自动关闭。这是iOS 8的问题。在iOS7上运行良好SLComposeViewController在iOS 8的Facebook上共享时自动关闭,ios,facebook,ios8,slcomposeviewcontroller,Ios,Facebook,Ios8,Slcomposeviewcontroller,我正在我的应用程序中使用SLComposeViewController在Twitter和Facebook上共享。它在Twitter上运行良好,但在Facebook上,SLComposeViewController会在选择位置时自动关闭。这是iOS 8的问题。在iOS7上运行良好 if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { self.fbSheet = [
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
self.fbSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){
// [fbSheet dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Cancelled.....");
}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Posted....");
if([NetworkManager SharedInstance].isInternetReachable){
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Success"
message:@"Feeds shared successfully."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
break;
}};
[self.fbSheet setCompletionHandler:completionHandler];
NSString *fbString= self.titleString;
[self.fbSheet setInitialText:fbString];
[self.fbSheet addURL:[NSURL URLWithString:self.urlString]];
[self presentViewController:self.fbSheet animated:YES completion:nil];
}
控件将自动进入完成处理程序块,结果为取消。我看过一些帖子,认为这是64位体系结构问题。如果有人面临同样的问题,请帮助我
- (IBAction)facebookPost:(id)sender {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
self.fbSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[self.fbSheet setInitialText:@"Social Framework test"];
[self.fbSheet addImage:[UIImage imageNamed:@"imagename.png"]];
[self.fbSheet addURL:[NSURL URLWithString:@"URL_NAME"]];
[self.fbSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
switch (result) {
case SLComposeViewControllerResultCancelled:
NSLog(@"Post Canceled");
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Post Sucessful");
NSLog(@"Posted....");
if([NetworkManager SharedInstance].isInternetReachable){
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Success"
message:@"Feeds shared successfully."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
break;
default:
break;
}
}];
[self presentViewController:self.fbSheet animated:YES completion:nil];
}
}