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 设置成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会使表头新增一段间隙,默认为UITableViewAutomaticDimension
// 此为全局配置,可在AppDelegate中全局统一配置
if (@available(iOS 15.0, *)) {
[UITableView appearance].sectionHeaderTopPadding = 0;
}
// 此方法为单一设置某个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 的显示大小,且可以通过拖拽手势在不同大小之间进行切换。只需要在跳转的目标 UIViewController 做如下处理
UISheetPresentationController *presentation = [UISheetPresentationController new];
// 显示时支持的尺寸
presentation.detents = @[UISheetPresentationControllerDetent.largeDetent,UISheetPresentationControllerDetent.mediumDetent]
// 显示一个指示器表示可以拖拽调整大小
presentation.prefersGrabberVisible = YES;
7.UIImageWriteToSavedPhotosAlbum存储图片之后的回调不再返回图片了,会返回nil,如果在回调方法里面操作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强制使用carplay.framework和Scene Session api 去实现carplay功能导致iOS13以下carplay版本无法兼容