ios – 正在进行演示时出席?尝试在Facebook登录后使用解析显示
发布时间:2020-12-15 01:50:51 所属栏目:百科 来源:网络整理
导读:我正在尝试提供一个UITableView,我已经为用户输入了数据并保存在解析中.我很确定我没有提供导航视图. 当我登录时,我收到错误: Checklists[4516:c07] Warning: Attempt to present ChecklistsViewController: 0x10525e90 on UINavigationController: 0x96482
我正在尝试提供一个UITableView,我已经为用户输入了数据并保存在解析中.我很确定我没有提供导航视图.
当我登录时,我收到错误: 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: 当我们不想要一个完成块时,我们只需将它设置为nil. 但在您的情况下,完成块可以解决您的问题…它确保了正确的事件序列,即在解雇完成之前不会进行呈现. - (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指出这个] (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |