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