ios - 无法实例化 UIApplication 子类实例。没有加载名为 %@ 的类。”

标签 ios iphone xcode emulation

我正在做一个简单的登录设置,其中检查了用户名和密码,如果它是真的,我将它们引导到新页面。但我得到了这个错误......请向我解释一下这种错误是什么意思。

以下是我的 ViewController.m 中的函数

- (IBAction)login:(id)sender 
{

    NSString *username = [_userName text];
    NSString *pass = [_password text];

    if ([username isEqualToString:@"admin"] && [pass isEqualToString:@"password"] ) {
         MiddleViewController *middle = [[MiddleViewController alloc] init];
        [self presentedViewController:middle animated:YES completion:nil];
   }
}

enter image description here

MiddleViewController 是 Storyboard上的子类 UIViewController。
然后,当我在字段中按下带有管理员和密码的按钮时,模拟器就会变暗。

最佳答案

在你的 main.m 中有一个 main 方法。

我的看起来像这样:

int main(int argc, char *argv[])
{
    @autoreleasepool
    {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

该消息中的最后一个参数是一个字符串,表示哪个类引用了应用程序的委托(delegate)。对你来说,这个字符串要么是 nil,要么是返回 nil。我感觉你有文字字符串 "%@"那里。

关于ios - 无法实例化 UIApplication 子类实例。没有加载名为 %@ 的类。”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32988266/

相关文章:

ios - 为什么通知会自动从 iOS 通知中心删除?

javascript - 无法使用 Xcode 7.3 将 React Native 应用程序上传到 iTunes Connect

ios - Xcode 11.1 似乎破坏了 com.apple.commcenter.coretelephony.xpc

iphone - 如何使用 Xcode 打开现有的 GitHub 项目?

iphone - 创建一个自定义 View ,其中包含一个 UIImage,其中包含一个 UILabel(在图像底部)

javascript - 放大 google map api 3 [ios]

ios - 在 iOS 中出现键盘时启用滚动内容

ios - 如何将图像 UIButton 缩放到插图?

ios - 在模拟器中滑动时,UISwipeGestureRecognizer 不会发送到 IBAction 方法

ios - Xcode 选项卡式应用程序 - 添加新选项卡 View