1、deviceToken的数据结构改变,需要更改取值方法(参考友盟):
if (![deviceToken isKindOfClass:[NSData class]]) return;
const unsigned *tokenBytes = (const unsigned *)[deviceToken bytes];
NSString *hexToken = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x",
ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];
self.devToken = hexToken;
NSLog(@"deviceToken:%@", self.devToken);
2、设置状态栏的背景颜色,原有的方式用到了KVC的valueForKey:
方法来获取系统API的私有属性,程序会crash,我的做法是这样的:
/**设置状态栏背景颜色*/
+ (void)setStatusBarBackgroundColor:(UIColor *)color control:(UIViewController *)control
{
// iOS13 之前
/*
UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
statusBar.backgroundColor = color;
}
*/
// iOS13 之后
control.navigationController.navigationBar.barTintColor = color;
}
3、新增设备型号:苹果官网设备型号说明,如果项目中用到了这个,需要把新增的设备型号加进去!