我正在使用Parse为应用程序创建登录页面。 我收到错误“可见@interface for'UIResponder'声明选择器'viewDidAppear'” 我也得到“可见@interface for'UIResponder'声明选择器'presentViewController:animated:present'”
所以,在我的AppDelegate.m中,我有:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];//I GET THE ERROR HERE
if (![PFUser currentUser]) { // No user logged in
// Create the log in view controller
PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
[logInViewController setDelegate:self]; // Set ourselves as the delegate
// Create the sign up view controller
PFSignUpViewController *signUpViewController = [[PFSignUpViewController 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];//I GET THE ERROR HERE
}
}
在我的AppDelegate.h中:
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
// Implement both delegates
@interface DefaultSettingsViewController :
UIViewController <PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate>
@end
我该如何解决此问题?
答案 0 :(得分:0)
您的超类需要是UIViewController
子类。在您的代码中,它是UIResponder
子类。
但我认为原因是你将应该放在视图控制器中的代码放入app委托。将viewDidAppear:
方法移动到视图控制器所在的位置。