ios12更新开发者须要作的

1.StatusBar内部结构改变

现象:crash网络

crash log:app

-[_UIStatusBarIdentifier isEqualToString:]: unrecognized selector sent to instance 0x283452820ide

* Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[_UIStatusBarIdentifier isEqualToString:]: unrecognized selector sent to instance 0x283452820post

问题代码和解决方法ui

+ (NSString *)getIphoneXNetWorkStates { spa

UIApplication *app = [UIApplication sharedApplication]; three

id statusBar = [[app valueForKeyPath:@"statusBar"] valueForKeyPath:@"statusBar"]; 图片

id one = [statusBar valueForKeyPath:@"regions"]; ip

id two = [one valueForKeyPath:@"trailing"]; get

NSArray *three = [two valueForKeyPath:@"displayItems"];

NSString *state = @"无网络";

for (UIView *view in three)

{ //alert: iOS12.0 状况下identifier的变成了类"_UIStatusBarIdentifier"而不是NSString,因此会在调用“isEqualToString”方法时发生crash

//修改前 // NSString *identifier = [view valueForKeyPath:@"identifier"];

//修改后

NSString *identifier = [[view valueForKeyPath:@"identifier"] description];

if ([identifier isEqualToString:@"_UIStatusBarWifiItem.signalStrengthDisplayIdentifier"]) {

id item = [view valueForKeyPath:@"_item"]; //alert: 这个问题和上边同样itemId是_UIStatusBarIdentifier 类型,不是string

NSString *itemId = [[item valueForKeyPath:@"identifier"] description];

if ([itemId isEqualToString:@"_UIStatusBarWifiItem"]) {

state = @"WIFI"; } state = @"不肯定"; } else if ([identifier isEqualToString:@"_UIStatusBarCellularItem.typeDisplayIdentifier"]) {

UIView *statusBarStringView = [view valueForKeyPath:@"_view"]; // 4G/3G/E state = [statusBarStringView valueForKeyPath:@"text"];

} } return state;

}

2.[UIImage imageNamed:]不能正常加载Assets中的图片

解决: 
将图片放到bundle中 
使用一下方式加载便可

NSString *path = [[NSBundle mainBundle] pathForResource:@"bg_login" ofType:@"png"]; _backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:path]];

这个不能正常加载的状况只出如今个别的地方,目前找到的共性是加载的图片偏大.

 

其余bug 参考

http://www.javashuo.com/article/p-qsjebkiq-cc.html

相关文章
相关标签/搜索