1

我正在使用 Parse 为应用程序制作登录页面。我收到错误“'UIResponder' 的可见@interface 声明选择器'viewDidAppear'”我还收到“'UIResponder' 的可见@interface 声明选择器'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

我该如何解决这个问题?

4

1 回答 1

0

您的超类必须是UIViewController子类。在您的代码中,它是一个UIResponder子类。

但我认为原因是您将应该进入视图控制器的代码放入应用程序委托中。将viewDidAppear:方法移动到需要的视图控制器。

于 2013-11-10T22:20:40.280 回答