Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: "attempt to insert nil object from objects[1]" when creating dictionary

I'm creating a custom navigation bar class and customizing it's title attributes using the following code:

self.titleTextAttributes = @{ UITextAttributeFont: bariol,
                              UITextAttributeTextColor: [UIColor whiteColor]
                            };

However, when I run the code, it returns the following error message:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]'

I'm using Xcode 4.6 and running on a device using iOS 6.

like image 978
beakr Avatar asked Feb 26 '13 21:02

beakr


1 Answers

This error seems to be somewhere else. It's pointing to an array error at object '1'. In your case you have a dictionary and object '1' is UITextAttributeTextColor: [UIColor whiteColor] which will never be nil.

like image 126
Andres Canella Avatar answered Sep 27 '22 22:09

Andres Canella