刚刚在我的 macbook 上切换到 XCode 5 和 iOS 7,认为一切都会正常工作,因为我没有做任何特别的事情,但它不起作用。
我在我的 6.1 应用程序上集成了 facebook,这就是我正在做的事情:
- (IBAction)facebookTapped:(UIButton *)sender {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//Check if the net is reachable
SLComposeViewController * faceSheet=[self.socialIntegration showFacebook:@"text" andImage:nil andLink:@"link" andView:self];
dispatch_sync(dispatch_get_main_queue(), ^{
//[self netConnectionTrue:cell Connected:answer];
//[tempAlertView show];
[self presentViewController:faceSheet animated:YES completion:NO];
});
});
}
现在当我按下按钮时,这就是我得到的:
+[SocailIntegration modalTransitionStyle]:无法识别的选择器发送到类 0x49b30
并且应用程序在此行中断: [self presentViewController:faceSheet animated:YES completion:NO];
任何人都知道为什么会发生这种情况?
编辑:这是我在 socialIntegration 类中的代码:
-(SLComposeViewController *) showFacebook:(NSString *) initialText andImage:(NSString *) imageName andLink:(NSString *) link andView:(UIViewController *) controller {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewController *faceSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[faceSheet setInitialText:initialText];
if (imageName.length!=0)
{
[faceSheet addImage:[UIImage imageNamed:imageName]];
}
if (link.length!=0)
{
[faceSheet addURL:[NSURL URLWithString:link]];
}
return faceSheet;
//[controller presentViewController:faceSheet animated:YES completion:nil];
}
else
{
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Sorry"
message:@"You can't send a status right now, make sure your device has an internet connection and you have at least one Facebook account setup"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}