[__NSArrayM insertObject:atIndex:]: object cannot be 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'

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

[self.window makeKeyAndVisible];

in the ASAppDelegate.m file.

The whole function is like this:

- (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; }

Could you please help me?

Thank you.


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.


  • Parse data from OpenWeatherMap, using retrofit2 and rxJava2
  • android memory usage and heap usage
  • Subsequent NSURLConnections not firing delegate methods
  • pip: need to change name of package tensorflow-gpu to tensorflow
  • Run command line containing multiple strings from python script
  • Is there an Cocoa or Objective C api for Java?
  • Is there an Cocoa or Objective C api for Java?
  • Output buffer
  • Is it safe to use *virtual* multiple inheritance if QObject is being derived from DIRECTLY?
  • UITabbarController dismiss modal UINavigationController
  • iOS: define and use C++ in Objective-C++
  • SQL - Comparing two rows and two columns
  • Objective-C Thread 1:Program received signal: “SIGABRT”
  • Using File.ReadAllLines from embedded text file
  • test driven asynch tasks
  • Polymer 1.x + Firebase 2.x: How to push or put data to Firebase using Polymerfire?
  • GAE Models: How to list child nodes in parent
  • Weird UIView coordinate issue
  • How to programmatically dismiss system dialogs like “ would like to access your photos”?
  • How to debug a Test Send in Azure?
  • multiple colors on beanplot in R
  • Google App Indexing not resolving for Swift?
  • Forms with Prism: Application windows are expected to have a root VC
  • Load 24 bit TGA
  • PHP file_exists() anomaly
  • Generate a unique string based on a pair of strings
  • Deleting a widget from QTableView
  • multidatatrigger with multibinding in ControlTemplate.Triggers
  • Is there a parser equivalent of 'fragment' marking in ANTLR4?
  • Build Successful but not running on simulator
  • iOS: Detect app start via notification press
  • Suggestions to manage Login/Logout transitions
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • Running Map reduces the dimensions of the matrices
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • How to push additional view controllers onto NavigationController but keep the TabBar?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?