iOS 7只有应用程序在启动时崩溃

我最近把我的xcode项目改成了iOS 7,而不是支持iOS 5.在应用程序启动后立即做出这个改变,我在控制台中得到这个消息。

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

我不确定是什么原因造成的。 但使用debugging器,好像我的应用程序委托在第一行代码崩溃。

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

任何帮助,将不胜感激

你可能做了我所做的,并过度地剪切并replaceUITextAttributeTextShadowColor和UITextAttributeTextShadowOffset的编译器警告。 所以你有这样的代码:

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

并用NSShadowAttributeNamereplace它们,并最终得到这样的代码:

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

你需要做的是有一个属性NSShadowAttributeName,并创build一个包含阴影颜色和阴影偏移的NSShadow实例。

 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];