[英]Parse [PFUser currentUser] Not Working
I am using Xcode and until today haven't realised any problems. 我正在使用Xcode,直到今天还没有意识到任何问题。 My AppDelegate employs the following code to determine where a user should be directed to the main window or to the login screen. 我的AppDelegate使用以下代码来确定用户应该定向到主窗口或登录屏幕的位置。
// determine the initial view controller here and instantiate it
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PFUser *currentUser = [PFUser currentUser];
UIViewController *viewController = [[UIViewController alloc] init];
if (!currentUser) {
// Show Login / Sign Up Window
viewController = [storyboard instantiateViewControllerWithIdentifier:@"signUpOrRegister"];
} else {
// User Logged In Already
viewController = [storyboard instantiateViewControllerWithIdentifier:@"rootVC"];
}
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
And then the following code to login. 然后以下代码登录。 The login is registered in the Log. 登录在日志中注册。
[PFUser logInWithUsernameInBackground:[_loginUsernameField.text lowercaseString]
password:_loginPasswordField.text
block:^(PFUser *user, NSError *error) {
if (user) {
// Do stuff after successful login.
[self displayMessageToUser:@"Welcome Back"];
NSLog(@"Successful: Login: %@", user.objectId);
[self segueToWindowOfChoice];
} else {
// The login failed. Check error to see why.
...
Any ideas? 有任何想法吗?
Thanks 谢谢
D :-) D :-)
I have solved it just by updating the Parse Framework which has strangely resolved the issue? 我刚刚通过更新Parse框架解决了这个问题,该框架奇怪地解决了这个问题? Might be useful for people in this situation in the future 对于未来这种情况的人们可能会有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.