1、UISearchController上的SearchBar显示异常,高度变为只有1px。

  解决方法:解决办法是使用KVO监听frame值变化后设置去应该显示的高度。

2、iOS13禁止使用valueForKey、setValue: forKey的方式获取和设置私有属性,会引起crash。

  解决方法:使用其他方法替换。

3、TabBar上设置的红点会偏移到左上方。遍历UITabBarButton的subViews发现只有在TabBar选中状态下才能取到UITabBarSwappableImageView

 解决方法:在选中状态下对tabbar 设置    [tabBar layoutIfNeeded];

4、控制器的 modalPresentationStyle 默认值变了 变为UIModalPresentationFullScreen;

解决方法:接受这种交互方式就不用做改动,如果想回复到之前的交互方式请直接设置:self.modalPresentationStyle = UIModalPresentationOverFullScreen;(注意:图片编辑器的类别可能需要设置一下self.modalPresentationStyle =UIModalPresentationFullScreen,否则有不能编辑图片的bug!!!)

5、MPMoviePlayerController在iOS13中不能使用

解决方法:需要使用AVKit中的AVPlayerViewController来达到播放的目的。

6、iOS13新增暗黑模式

没有适配暗黑模式前,请先禁用:在info.plist文件中UIUserInterfaceStyle设置为light。

7、 LaunchImage即将废弃

从 iOS 8 的时候,苹果就引入了 LaunchScreen,我们可以设置 LaunchScreen来作为启动页。当然,现在你还可以使用LaunchImage来设置启动图。不过使用LaunchImage的话,要求我们必须提供各种屏幕尺寸的启动图,来适配各种设备,随着苹果设备尺寸越来越多,这种方式显然不够 Flexible。而使用 LaunchScreen的话,情况会变的很简单, LaunchScreen是支持AutoLayout+SizeClass的,所以适配各种屏幕都不在话下。 所以要注意啦⚠️,从2020年4月开始,所有使⽤ iOS13 SDK 的 App 将必须提供 LaunchScreen,LaunchImage即将退出历史舞台 

8、废弃 UISearchDisplayController

在 iOS 8 之前,我们在 UITableView 上添加搜索框需要使用 UISearchBar + UISearchDisplayController 的组合方式,而在 iOS 8 之后,苹果就已经推出了 UISearchController 来代替这个组合方式。在 iOS 13 中,如果还继续使用 UISearchDisplayController 会直接导致崩溃。在搜索结果页模态时 必须用UIModalPresentationCustom模式

原因是 UISearchController modelPrsentationStyle 只有三种

UIModalPresentationFormSheet 模态依然少一节

UIModalPresentationCustom、模态全屏展示 UISearchController不会崩溃

UIModalPresentationPopover、 模态依然少一节

系统也走这个方法,变成UIModalPresentationFullScreen之后崩溃

替换的分类是:  https://github.com/HDB-Li/UIViewController(暂时不用)

9、私有KVC

在使用iOS 13运行项目时突然APP就crash掉了。定位到的问题是在设置UITextField的Placeholder也就是占位文本的颜色和字体时使用了KVC的方法:

[_textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
[_textField setValue:[UIFont systemFontOfSize:14] forKeyPath:@"_placeholderLabel.font"];

可以将其替换为:

_textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"文本" attributes:@{
NSFontAttributeName:[UIFont systemFontOfSize:16],
NSForegroundColorAttributeName:[UIColor redColor]}];
并且只需要在初始化的时候设置attributedPlaceholder即富文本的占位文本,再重新赋值依然使用placeolder直接设置文本内容,样式不会改变。

10、使用MJExtension 中处理NSNull的不同

这个直接会导致Crash的在将服务端数据字典转换为模型时,如果遇到服务端给的数据为NSNull时, mj_JSONObject,其中 class_copyPropertyList方法得到的属性里,多了一种EFSQLBinding类型的东西,而且属性数量也不准确, 那就没办法了, 我只能改写这个方法了,这个组件没有更新的情况下,写了一个方法swizzling掉把当遇到 NSNull时,直接转为nil了。

11、WKWebView 中测量页面内容高度的方式变更

iOS 13以前 document.body.scrollHeight iOS 13中 document.documentElement.scrollHeight 两者相差55 应该是浏览器定义高度变了

12、UISegmentedControl 选中的颜色

if ( @available(iOS 13.0, *)) {
           self.segmentedControl.selectedSegmentTintColor = [UIColor clearColor];

       }else
       {
           self.segmentedControl.tintColor = [UIColor clearColor];

       }

参考链接如下:

https://www.jianshu.com/p/f6960644d38e