1.Xcode13 必須用這個模式
File -> Workspace Setting ->New Build System
這個模式下項目中或有多余的md ,plist文件需要刪除
2.Building for iOS Simulator, but the linked framework 'xxxxx.framework' was built for iOS.
Build settings -> Vailidate Workspace 設(shè)置成YES
3.NavigationBar背景顏色失效,有的變白色,有的變黑色問題
UINavigationBarAppearance *barApp = [UINavigationBarAppearance new];
barApp.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor blackColor],
NSFontAttributeName: [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]};
barApp.backgroundColor = UIColor.whiteColor;
self.navigationController.navigationBar.scrollEdgeAppearance = barApp; // 可滑動界面配置
self.navigationController.navigationBar.standardAppearance = barApp; // 普通頁面配置
}else{
self.navigationController.navigationBar.backgroundColor = UIColor.whiteColor;
[self.navigationController.navigationBar setBarTintColor:UIColor.whiteColor];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:UIColor.whiteColor] forBarMetrics:(UIBarMetricsDefault)];
[self.navigationController.navigationBar setShadowImage:[UIImage imageWithColor:UIColor.whiteColor]];
}
4.UITableView新增sectionHeaderTopPadding會使表頭新增一段間隙,默認(rèn)為UITableViewAutomaticDimension
// 此為全局配置,可在AppDelegate中全局統(tǒng)一配置
if (@available(iOS 15.0, *)) {
[UITableView appearance].sectionHeaderTopPadding = 0;
}
// 此方法為單一設(shè)置某個tableview
if (@available(iOS 15.0, *)) {
_tableView.sectionHeaderTopPadding = 0;
}
5.Encountered an error communicating with IBAgent-iOS.
解決方案如下:
重啟清理Xcode緩存,重啟Xcode。(如果依然存在,那就重啟清理完重啟下電腦。
TabBarItem失效
UITabBarItem *tabBarItem = [UITabBarItem appearance];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:DARKGRAYCOLOR,NSForegroundColorAttributeName,nil];
NSDictionary *selectAttributes =[NSDictionary dictionaryWithObjectsAndKeys:BLUECOLOR,NSForegroundColorAttributeName, nil];
if (@available(iOS 15.0, *)) {
UITabBarAppearance * appearance = [UITabBarAppearance new];
appearance.shadowColor = [UIColor clearColor];
appearance.stackedLayoutAppearance.normal.titleTextAttributes = attributes;
appearance.stackedLayoutAppearance.selected.titleTextAttributes = selectAttributes;
self.tabBar.standardAppearance = appearance;
} else {
[tabBarItem setTitleTextAttributes:attributes forState:UIControlStateNormal];
[tabBarItem setTitleTextAttributes:selectAttributes forState:UIControlStateSelected];
}
6.增加UISheetPresentationController,通過它可以控制 Modal 出來的 UIViewController 的顯示大小,且可以通過拖拽手勢在不同大小之間進(jìn)行切換。只需要在跳轉(zhuǎn)的目標(biāo) UIViewController 做如下處理
UISheetPresentationController *presentation = [UISheetPresentationController new];
// 顯示時支持的尺寸
presentation.detents = @[UISheetPresentationControllerDetent.largeDetent,UISheetPresentationControllerDetent.mediumDetent]
// 顯示一個指示器表示可以拖拽調(diào)整大小
presentation.prefersGrabberVisible = YES;
7.UIImageWriteToSavedPhotosAlbum存儲圖片之后的回調(diào)不再返回圖片了,會返回nil,如果在回調(diào)方法里面操作image有可能會直接Crash,目前的解決辦法聲明一個全局image去記錄,后面再去操作
self.image = image;
UIImageWriteToSavedPhotosAlbum(image,self,@selector(image:didFinishSavingWithError:contextInfo:), NULL);
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{
// self.image doing...
}
8.iOS15 carplay無法鏈接
因為舊的MPPlayableContentManager 的api只支持到iOS14 ,iOS15強(qiáng)制使用carplay.framework和Scene Session api 去實現(xiàn)carplay功能導(dǎo)致iOS13以下carplay版本無法兼容