I'm using NSDictionary to change the appearance of UIBarButtonItem in the appDelegate file:
UIBarButtonItem *barButtonItemProxy = [UIBarButtonItem appearanceWhenContainedIn:
[UINavigationBar class], [UINavigationController class], nil];
NSDictionary *textAttributes = @{UITextAttributeFont :
[UIFont fontWithName:@"ChocoBold" size:13.0f],
UITextAttributeTextColor : [UIColor whiteColor],
UITextAttributeTextShadowColor : [UIColor blackColor],
UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake(0.0f, -1.0f)]
};
[barButtonItemProxy setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
The app works fine in the simulator but when I run it on a device the app crashes with the following exception:
[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
The crash happens in NSDictionary *textAttributes
line.
I don't understand which parameter is nil in that dictionary?