简体   繁体   English

在演示过程中出现? 尝试使用分析功能登录Facebook后显示新视图。

[英]Present while a presentation is in progress? Trying to display a new view after facebook login with parse.

I'm trying to present a UITableView I've already made for users to put in data and save in parse. 我正在尝试呈现一个UITableView,供用户放入数据并保存在解析中。 I'm pretty sure I don't present the navigation view. 我很确定我不会显示导航视图。

When I log in, I get the error: 登录时出现错误:

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

Thanks for your help. 谢谢你的帮助。

#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];

}

This method has been deprecated for a good while 这个方法已经被淘汰了好一阵子

     presentModalViewController:animated:

You should use this instead 你应该改用这个

    presentViewController:animated:completion:

Same goes for this 一样

    dismissModalViewControllerAnimated:

Now we use this 现在我们用这个

    dismissViewControllerAnimated:completion:

When we don't want a completion block, we just set it to nil. 当我们不需要完成块时,只需将其设置为nil。

But in your case, a completion block could fix your problem... it ensures a correct sequence of events, ie the presenting won't take place until the dismissing is complete. 但是在您的情况下,完成块可以解决您的问题……它可以确保事件的正确顺序,即在解雇完成之前不会进行演示。

    - (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 was incorrect in your original code, I have changed that also. [注意-modalTransitionStyle在您的原始代码中不正确,我也对此进行了更改。 Thanks to Daniel G for pointing this out] 感谢Daniel G指出这一点]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Beta测试,Facebook登录,解析。 某些用户的Facebook信息未保存到Parse。 迅速 - Beta Testing, Facebook login, Parse. Some users Facebook information is not getting saved to Parse. Swift 简单视图控制器开关导致:在演示文稿正在进行时尝试显示 - Simple view controller switch causes: Attempt to present while a presentation is in progress Swift - 警告:在演示过程中尝试在 * 上演示 * - Swift - Warning: Attempt to present * on * while a presentation is in progress 警告:尝试呈现 - Warning: Attempt to present <UINavigationController while a presentation is in progress 警告:在演示文稿正在进行时尝试显示uiimagepickercontroller - Warning: Attempt to present uiimagepickercontroller while a presentation is in progress 在演示过程中尝试在UITabBarController上呈现UIImagePickerController - Attempt to present UIImagePickerController on UITabBarController while a presentation is in progress 在演示过程中尝试呈现 UIViewController!-警告 - Attempt to present UIViewController while a presentation is in progress!-Warning 演示过程中尝试在&lt;**&gt;上演示&lt;**&gt;。 在使用swift从一个视图控制器到另一个视图控制器执行segue的同时 - Attempting to present <**> on <**> while a presentation is in progress. While performing a segue from one view controller to another using swift 登录后如何在 SwiftUI 中呈现新视图 - How to present new view in SwiftUI after login Xcode5错误:警告尝试呈现 <View> 上 <OtherView> 在进行演示时 - Xcode5 error : Warning attempt to present <View> on <OtherView> while presentation is in progress
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM