I'm attempting to build a simple app in Objective C, utilizing an attributes Dictionary in my AppDelegate
module to allow me to customize the look of various navigation items of my story layout.
The code builds fine with no errors but as it deploys onto my test device I get a SIGABRT.
I'm using latest version Xcode(9.2); storyboards are all set to "Builds for iOS 8.2 and Later"; Deployment Target is set at 8.1.
I had utilized UITextAttributeTextShadowColor, nil
in my code without issues, but that is deprecated since iOS 7.0 so I updated it to NSShadowAttributeName, nil
and now it won't work.
What am I doing wrong?
The specific SIGABRT error reads: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor shadowColor]: unrecognized selector sent to instance 0x1d447cf00'.
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:170.0/255.0 green:21.0/255.0 blue:29.0/255.0 alpha:1.0],
NSForegroundColorAttributeName,
[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0],
NSShadowAttributeName, nil];
[[UINavigationBar appearance] setTitleTextAttributes: attribs];
[[UIBarButtonItem appearance] setTitleTextAttributes: attribs forState:UIControlStateNormal];
return YES;
}