在iOS13中modalPresentationStyle的默认改成UIModalPresentationAutomatic,而在以前默认是UIModalPresentationFullScreen。bash
要改会原来模态视图样式,咱们只须要把UIModalPresentationStyle设置为UIModalPresentationFullScreen便可微信
若是是从控制器跳转的,这个属性设置在控制器
若是是封装了一个单独的导航栏跳转,则这个属性设置在导航栏app
iOS不容许valueForKey、setValue: forKey获取和设置私有属性,须要使用其它方式修改ui
如:this
[textField setValue:[UIColor red] forKeyPath:@"_placeholderLabel.textColor”]; [textField setValue:[UIFont boldSystemFontOfSize:12] forKeyPath:@"_placeholderLabel.font"]; 复制代码
//替换为spa
textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@“请输入”attributes:
@{NSForegroundColorAttributeName:[UIColor red],NSFontAttributeName:[UIFont boldSystemFontOfSize:12]}];
复制代码
我还遇到了以下的写法:(获取默认文字的颜色,并用一个UIColor接收。目前还没找到合适的替换方法,若是你有比较好的方案可在下方留言!)code
UIColor *color = [textField valueForKeyPath:@"_placeholderLabel.textColor"];
复制代码
Sign in with Apple -提供第三方登陆的注意啦orm
若是你的应用使用了第三方登陆,那么你可能也须要加下 「Sign in with Apple」.
Sign In with Apple will be available for beta testing this summer. It will be required as an option
for users in apps that support third-party sign-in when it is commercially available later this year.cdn
若是苹果开发者提供任何其余第三方登陆,同时须要提供“苹果登陆”选项。也就是说,若是软件要求“微信登陆”或是“QQ登陆”时,必须同时提供“苹果登陆”的选项给用户自行选择。根据苹果公司最新公布的指南,要求开发者在苹果终端的应用程序登陆界面上,将“苹果登陆”选项列在任何其余第三方登陆的选项之上。token
虽然这只是苹果的指南建议,并不是苹果商店的审查要求,可是开发者认为这无疑是经过苹果审核的一个好方法
官方Demo:点我下载
TextField
升级到iOS13,UISearchController上的SearchBar显示异常,查看后发现对应的高度只有1px,目前没找到具体致使的缘由,解决办法是使用KVO监听frame值变化后设置去应该显示的高度
黑线处理crash
以前为了处理搜索框的黑线问题会遍历后删除UISearchBarBackground,在iOS13会致使UI渲染失败crash; 解决办法是设置UISearchBarBackground的layer.contents为nil
public func clearBlackLine() {
for view in self.subviews.last!.subviews {
if view.isKind(of: NSClassFromString("UISearchBarBackground")!) {
view.backgroundColor = UIColor.white
view.layer.contents = nil
break
}
}
}
复制代码
若是以前有经过TabBar上图片位置来设置红点位置,在iOS13上会发现显示位置都在最左边去了。遍历UITabBarButton的subViews发现只有在TabBar选中状态下才能取到UITabBarSwappableImageView,解决办法是修改成经过UITabBarButton的位置来设置红点的frame
MPMoviePlayerController 在iOS 13已经不能用了
'MPMoviePlayerController is no longer available. Use AVPlayerViewController in AVKit.'
解决方案:既然不能再用了,那只能换掉了。替代方案就是AVKit里面的那套播放器。(DDW使用的AVKit)
iOS 13 DeviceToken有变化,原有的方法已经没法获取到准确的DeviceToken字符串了
NSString *dt = [deviceToken description];
dt = [dt stringByReplacingOccurrencesOfString: @"<" withString: @""];
dt = [dt stringByReplacingOccurrencesOfString: @">" withString: @""];
dt = [dt stringByReplacingOccurrencesOfString: @" " withString: @""];
这段代码运行在 iOS 13 上已经没法获取到准确的DeviceToken字符串了,iOS 13 经过[deviceToken description]获取到的内容已经变了。
复制代码
解决方案
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
if (![deviceToken isKindOfClass:[NSData class]]) return;
const unsigned *tokenBytes = [deviceToken bytes];
NSString *hexToken = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x",
ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];
NSLog(@"deviceToken:%@",hexToken);
}
复制代码
即将废弃的 LaunchImage
从 iOS 8 的时候,苹果就引入了 LaunchScreen,咱们能够设置
LaunchScreen来做为启动页。固然,如今你还可使用
LaunchImage来设置启动图。不过使用LaunchImage的话,要求咱们必须提供各类屏幕尺寸的启动图,来适配各类设备,
随着苹果设备尺寸愈来愈多,这种方式显然不够 Flexible。而使用 LaunchScreen的话,状况会变的很简单,
LaunchScreen是支持AutoLayout+SizeClass的,因此适配各类屏幕都不在话下。
注意啦,从2020年4月开始,全部使⽤ iOS13 SDK的 App将必须提供 LaunchScreen,LaunchImage即将退出历史舞台。
如发现遗漏或者错误,请在下方评论区留言。