[__NSArrayM insertObject:atIndex:]: 对象不能为 nil [英] [__NSArrayM insertObject:atIndex:]: object cannot be nil

查看:100
本文介绍了[__NSArrayM insertObject:atIndex:]: 对象不能为 nil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,我找不到我收到以下错误:

For some reason that I cannot find I am getting the following error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

由于我对 xCode 还很陌生,我需要一些帮助.应用程序在以下行崩溃:

As I am quite new in xCode i'd like some help. The application crashes in the following line:

[self.window makeKeyAndVisible];

在 ASAppDelegate.m 文件中.

in the ASAppDelegate.m file.

整个函数是这样的:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.

AS_MainViewController *MyrootViewController = [[AS_MainViewController alloc]
                        initWithNibName:@"AS_MainViewController" bundle: [NSBundle mainBundle]];

self.window.rootViewController = MyrootViewController;

self.window.backgroundColor = [UIColor whiteColor];

return YES;
}

你能帮我吗?

谢谢.

推荐答案

终于解决了这个错误.我开始了一个新的空项目,并从一开始就完成了所有工作.因为我也是从旧的复制粘贴的,所以我一步一步地每一步都在运行.应用程序运行没有问题.我完成了它,现在它运行了.我可以理解这个错误的原因和原因,但是在一个新项目(与旧项目具有相同的代码)中,问题不存在!

finally the error has been resolved. I started a new empty project and did all the work from the beginning. As I was also copy-pasting from the old one, step by step I was also running each time in every step. The application run without problems. I finished it and now it runs. I could ever understand why and what this error was, but in a new project (having the same code with the old one) the problem does not exist!

无论如何,谢谢你的帮助.

Anyway, thank you for your help.

这篇关于[__NSArrayM insertObject:atIndex:]: 对象不能为 nil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆