![](/img/trans.png)
[英]Beta Testing, Facebook login, Parse. Some users Facebook information is not getting saved to Parse. Swift
[英]Present while a presentation is in progress? Trying to display a new view after facebook login with parse.
我正在嘗試呈現一個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];
}];
}
[注意-modalTransitionStyle在您的原始代碼中不正確,我也對此進行了更改。 感謝Daniel G指出這一點]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.