屏幕快照 2019-10-21 上午11.01.50.png 原因: 在iOS13中modalPresentationStyle的默认改为UIModalPresentationAutomatic,而在之前默认是UIModalPresentationFullScreen。
/*
Defines the presentation style that will be used for this view controller when it is presented modally. Set this property on the view controller to be presented, not the presenter.
If this property has been set to UIModalPresentationAutomatic, reading it will always return a concrete presentation style. By default UIViewController resolves UIModalPresentationAutomatic to UIModalPresentationPageSheet, but other system-provided view controllers may resolve UIModalPresentationAutomatic to other concrete presentation styles.
Defaults to UIModalPresentationAutomatic on iOS starting in iOS 13.0, and UIModalPresentationFullScreen on previous versions. Defaults to UIModalPresentationFullScreen on all other platforms.
*/
@property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle API_AVAILABLE(ios(3.2));
解决方案:
LoginViewController *vc=[[LoginViewController alloc]init];
vc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:vc animated:YES completion:^{}];
奔溃截图
原因:iOS不允许valueForKey、setValue: forKey获取和设置私有属性。
解决方案:
NSMutableAttributedString *placeholderString = [[NSMutableAttributedString alloc] initWithString:placeHolder attributes:@{NSForegroundColorAttributeName : RGB(153, 153, 153)}];
textField.attributedPlaceholder = placeholderString;
解决方案:
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
if(@available(iOS 13.0, *)){
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDarkContent;
}
原因:iOS13使用暗黑模式时,UIView默认背景色会变成暗黑色。 解决方案:每个UIView都做修改是不现实的,统一的实现方式为: 在plist文件中增加配置项UIUserInterfaceStyle,值为UIUserInterfaceStyleLight。
5.KVC获取状态栏(_statusBar)会导致崩溃,目的是为更改状态栏背景色
原因:
UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
解决方案:
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
UIView *viewStatusColorBlend = [[UIView alloc]initWithFrame:keyWindow.windowScene.statusBarManager.statusBarFrame];
viewStatusColorBlend.backgroundColor = Color;
[keyWindow addSubview:viewStatusColorBlend];
6.iOS 13 DeviceToken有变化 原因:
NSString *token = [deviceToken description];
token = [token stringByReplacingOccurrencesOfString: @"<" withString: @""];
token = [token stringByReplacingOccurrencesOfString: @">" withString: @""];
token = [token 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);
}
7.ios 13蓝牙权限更新 原因:上传App Store时,如果引用了CoreBluetooth.framework,则需要添加描述配置NSBluetoothAlwaysUsageDescription,否则无法提交。
解决方案: 在plist文件中增加配置项NSBluetoothAlwaysUsageDescription。
8.通过kvc获取获取searchBar中的TextField方法更改,会引起崩溃 原因: ios13之后把SearchBar中的textField直接暴露给开发者使用,无需在通过kvc获取。 解决方案:
UITextField * searchField = nil;
if (@available(iOS 13.0, *)) {
searchField =searchBar.searchTextField;
}else {
searchField = [searchBar valueForKey:@"_searchField"];
}
NSMutableAttributedString *arrStr = [[NSMutableAttributedString alloc] initWithString:searchField.placeholder attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:[UIColor colorWithHex:@"#999999"]}];
searchField.attributedPlaceholder = arrStr;
10.UISegmentedControl 默认样式改变 默认样式变为白底黑字,如果设置修改过颜色的话,页面需要修改。 11.Sign in with Apple 第三方登录 当 Sign In with Apple 服务正式上线以后,所有已接入其它第三方登录的 App,就必须支持苹果登录。