1

当我设置

[self presentModalViewController:Facebookcontroller animated:YES];

[self presentViewController:Facebookcontroller animated:YES completion:nil];

删除 presentModalViewController:animated is deprecated: first deprecated in iOS 6.0

弹出另一个警告:

找不到实例方法'-presentModalViewController:animated:completion:'(返回类型默认为'id')

4

1 回答 1

0
  1. 您确定self在这种情况下是 UIViewController 吗?您只能从另一个 UIViewController 调用此代码。

  2. 确保首先初始化 Facebookcontroller 类,不能只传递该类。Facebookcontroller *facebookController = Facebookcontroller alloc] init];

对于 iOS 6 使用:

[self presentViewController:Facebookcontroller animated:YES completion:^{
    //Do whatever you want to do when the controller 'Facebookcontroller' is presented.
}];

或者

[self presentViewController:Facebookcontroller animated:YES completion:nil];

您可以在此处找到参考。

于 2012-11-01T14:01:24.267 回答