更新:收到了苹果发送的邮件,称该漏洞/问题已经修复,下一个SDK版本将不再存在此问题。和平!
我在AppDelegate的代码中有这个内容:
- (void) customizeAppearance {
[[UISwitch appearance] setOnTintColor:[UIColor colorWithRed:0 green:175.0/255.0 blue:176.0/255.0 alpha:1.0]];
[[UISwitch appearance] setTintColor:[UIColor colorWithRed:255.0f/255.0f green:255.0f/255.0f blue:255.0f/255.0f alpha:1.000f]];
[[UISwitch appearance] setThumbTintColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]];
}
我随后从 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
中调用了它。
我也使用ARC。在iOS 6中,我的应用程序一直崩溃。我启用了NSZombie并且它不断地显示:*** -[UIDeviceRGBColor release]: message sent to deallocated instance 0x9658eb0
现在我已经意识到上述问题的一个完美可重现流程。当我仅在customizeAppearance函数内注释掉setThumbTintColor代码行时,一切都正常工作。当我改用setThumbTintColor时,应用程序每次都以相同的方式崩溃。
如果UISwitch/setThumbTintColor/UIColor的问题对任何人来说已经是众所周知的,请告诉我。如果不是开关颜色,还可能是什么原因?