报错代码
+[UITabBarItem appearanceWhenContainedInInstancesOfClasses:]: unrecognized selector sent to class 0x1952fed50
2017-11-20 09:54:52.370 HuiBao[565:107606] [Bugly] Trapped uncaught exception 'NSInvalidArgumentException', reason: '+[UITabBarItem appearanceWhenContainedInInstancesOfClasses:]: unrecognized selector sent to class 0x1952fed50'
刚好有个同事拿了一个版本iOS8.0的手机会导致崩溃, 看到崩溃信息,我瞬间也快崩溃了,因为我设置的版本支持号是8.0,而方法支持的是9.0,查看了一下API
+ (instancetype)appearanceWhenContainedIn:(nullable Class <UIAppearanceContainer>)ContainerClass, ... NS_REQUIRES_NIL_TERMINATION NS_DEPRECATED_IOS(5_0, 9_0, "Use +appearanceWhenContainedInInstancesOfClasses: instead") __TVOS_PROHIBITED;
+ (instancetype)appearanceWhenContainedInInstancesOfClasses:(NSArray<Class <UIAppearanceContainer>> *)containerTypes NS_AVAILABLE_IOS(9_0);
总结
写代码的时候还是要注意版本的兼容问题,不要犯一些非常低级的错误;