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

相關文章
相關標籤/搜索