目前正在进行演示? 试图显示一个新的看法后,Facebookloginparsing。

我试图提出一个UITableView我已经为用户input数据并保存parsing。 我很确定我不介绍导航视图。

当我login时,我得到错误:

Checklists[4516:c07] Warning: Attempt to present <ChecklistsViewController: 0x10525e90> on <UINavigationController: 0x9648270> while a presentation is in progress! 

谢谢你的帮助。

 #import "LoginViewController.h" #import "ChecklistsViewController.h" #import "SetupViewController.h" #import <Parse/Parse.h> @interface LoginViewController () @end @implementation LoginViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; PFLogInViewController *login = [[PFLogInViewController alloc] init]; login.fields = PFLogInFieldsFacebook; // Need to set the delegate to be this controller. login.delegate = self; login.signUpController.delegate = self; //signUpController is a property on the login view controller [self presentModalViewController:login animated:NO]; } - (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user { [self dismissModalViewControllerAnimated:YES]; NSLog(@"Successfully logged in."); ChecklistsViewController *controller = [[ChecklistsViewController alloc] initWithStyle:UITableViewStylePlain]; controller.modalTransitionStyle = UITableViewStylePlain; [self presentModalViewController:controller animated:YES]; } 

此方法已被弃用一段时间

  presentModalViewController:animated: 

你应该用这个来代替

  presentViewController:animated:completion: 

这同样如此

  dismissModalViewControllerAnimated: 

现在我们使用这个

  dismissViewControllerAnimated:completion: 

当我们不想要一个完成块时,我们将它设置为零。

但在你的情况下,一个完成块可以解决你的问题……它确保了一个正确的事件序列,即提出不会发生,直到解雇完成。

  - (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user { [self dismissViewControllerAnimated:YES completion:^{ NSLog(@"Successfully logged in."); ChecklistsViewController *controller = [[ChecklistsViewController alloc] initWithStyle:UITableViewStylePlain]; controller.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentViewController:controller animated:YES completion:nil]; }]; } 

[NB – modalTransitionStyle在你原来的代码中是不正确的,我也改变了。 感谢Daniel G指出这一点]