Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7 Only App Crashes at Startup

Tags:

I recently changed my xcode project to be iOS 7 only instead of supporting iOS 5. After making this change as soon as the app starts I get this message in the console.

-[UICachedDeviceWhiteColor shadowColor]: unrecognized selector sent to instance 0x156f22f0 

I'm not sure what is causing this. But using the debugger it seems like my app delegate is crashing at the first line of code.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  self.window.rootViewController = self.tabBarController; //this line is where it crashes  [self.window makeKeyAndVisible]; 

Any help would be appreciated

like image 985
Hackmodford Avatar asked Sep 23 '13 20:09

Hackmodford


People also ask

Why does an app keep crashing as soon as I open it?

Apps on Android can crash because of low storage space, too many apps running simultaneously, a weak internet connection, or not having the proper app updates installed.

Why do my iPhone 7 apps keep crashing?

Sometimes when you don't restart your iPhone 7 or iPhone 7 Plus in several days, apps start to freeze and crash randomly. The reason for this is because the app may keep crashing is due to a memory glitch. By turning the iPhone 7 or iPhone 7 Plus on and off, it could solve that problem.

Why is my app crashing right when I open it IOS?

Most often, apps crash because they aren't updated and have unaddressed bugs. To fix this, go to the Updates section of the App Store and update the app if an update is available.


1 Answers

You probably did what I did, and overzealously cut and replaced the compiler warnings for UITextAttributeTextShadowColor and UITextAttributeTextShadowOffset. So you had code that looked like this:

NSDictionary *titleAttributes = @{UITextAttributeTextColor: [UIColor whiteColor],                                   UITextAttributeTextShadowColor: [UIColor blackColor],                                   UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(1, 0)],                                   UITextAttributeFont: [UIFont titleBolder]}; [[UINavigationBar appearance] setTitleTextAttributes:titleAttributes]; 

and replaced them both with NSShadowAttributeName, and ended up with some code like this:

NSDictionary *titleAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor],                                   NSShadowAttributeName: [UIColor blackColor],                                   NSShadowAttributeName: [NSValue valueWithUIOffset:UIOffsetMake(1, 0)],                                   NSFontAttributeName: [UIFont titleBolder]}; [[UINavigationBar appearance] setTitleTextAttributes:titleAttributes]; 

What you need to do is have one attribute NSShadowAttributeName, and create an instance of NSShadow that contains the shadow color and shadow offset.

NSShadow *shadow = [[NSShadow alloc] init]; shadow.shadowColor = [UIColor blackColor]; shadow.shadowOffset = CGSizeMake(1, 0); NSDictionary *titleAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor],                                   NSShadowAttributeName: shadow,                                   NSFontAttributeName: [UIFont titleBolder]}; [[UINavigationBar appearance] setTitleTextAttributes:titleAttributes]; 
like image 52
bandejapaisa Avatar answered Oct 12 '22 13:10

bandejapaisa