我正在使用 NSDictionary 更改 appDelegate 文件中 UIBarButtonItem 的外观:
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];
该应用程序在模拟器中运行良好,但是当我在设备上运行它时,应用程序崩溃并出现以下异常:
[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
崩溃发生在NSDictionary *textAttributes
队列中。
我不明白该字典中哪个参数为零?