在ios sdk中,PFLogInViewController.h
和PFSignUpViewController.h
不在Parse.framework
的headers
文件夹中,我在ParseUI.framework
中找到了它们。当我尝试将它们添加到UIViewController
时,Xcode无法识别它们。
如果需要的话,我将Parse UI框架拖到xcode>copy items中的窗口中,它在Build Phases>link binary中显示得很好。
#import <UIKit/UIKit.h>
#import <ParseUI/ParseUI.h>
#import "PFLogInViewController.h" //PFLogInViewController.h is not found
@interface LoginConfigVC : UIViewController <PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate>
你知道怎么解决这个问题吗?
Paul您不必#导入ParseUI导入中包含的头文件(作为他们新转移到UI专用元素的一部分,请参阅此处或此处查看我的答案)
您所要做的就是在任何View Controllers viewDidAppear
方法中调用PFLogInViewController
,因此删除您的#import "PFLogInViewController.h"
行,下面是调用接口的简短示例:
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (![PFUser currentUser]) { // No user logged in
// Create the log in view controller
LoginViewController *logInViewController = [[LoginViewController alloc] init];
[logInViewController setDelegate:self]; // Set ourselves as the delegate
[logInViewController setFields:PFLogInFieldsUsernameAndPassword | PFLogInFieldsSignUpButton | PFLogInFieldsPasswordForgotten | PFLogInFieldsLogInButton];
// Create the sign up view controller
SignupViewController *signUpViewController = [[SignupViewController alloc] init];
[signUpViewController setDelegate:self]; // Set ourselves as the delegate
// Assign our sign up controller to be displayed from the login controller
[logInViewController setSignUpController:signUpViewController];
// Present the log in view controller
[self presentViewController:logInViewController animated:YES completion:NULL];
}
}
有关更全面的演练,请参阅他们的指南