提交 0c262e25 编写于 作者: Y yixiang

解决UIAlertControllerStyleActionSheet在ipad crash问题

上级 358bbe82
......@@ -33,6 +33,8 @@
+ (BOOL)isIPhoneXSeries;
+ (BOOL)isIpad;
+ (NSString *)locationAuthority;
+ (NSString *)pushAuthority;
......
......@@ -100,6 +100,14 @@
return iPhoneXSeries;
}
+ (BOOL)isIpad{
NSString *deviceType = [UIDevice currentDevice].model;
if ([deviceType isEqualToString:@"iPad"]) {
return YES;
}
return NO;
}
+ (NSString *)locationAuthority{
NSString *authority = @"";
if ([CLLocationManager locationServicesEnabled]) {
......
......@@ -132,7 +132,14 @@ static NSString *const kDoreamonCrashListCellIdentifier = @"kDoreamonCrashListCe
#pragma mark HandleFile
- (void)handleFileWithPath:(NSString *)filePath{
UIAlertController *alertVc = [UIAlertController alertControllerWithTitle:DoraemonLocalizedString(@"请选择操作方式") message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertControllerStyle style;
if ([DoraemonAppInfoUtil isIpad]) {
style = UIAlertControllerStyleAlert;
}else{
style = UIAlertControllerStyleActionSheet;
}
UIAlertController *alertVc = [UIAlertController alertControllerWithTitle:DoraemonLocalizedString(@"请选择操作方式") message:nil preferredStyle:style];
__weak typeof(self) weakSelf = self;
UIAlertAction *previewAction = [UIAlertAction actionWithTitle:DoraemonLocalizedString(@"本地预览") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
__strong typeof(self) strongSelf = weakSelf;
......
......@@ -13,6 +13,7 @@
#import "UIView+Doraemon.h"
#import "DoraemonNavBarItemModel.h"
#import "UIImage+Doraemon.h"
#import "DoraemonAppInfoUtil.h"
@interface DoraemonSandboxViewController ()<UITableViewDelegate,UITableViewDataSource>
......@@ -165,7 +166,14 @@
}
- (void)handleFileWithPath:(NSString *)filePath{
UIAlertController *alertVc = [UIAlertController alertControllerWithTitle:DoraemonLocalizedString(@"请选择操作方式") message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertControllerStyle style;
if ([DoraemonAppInfoUtil isIpad]) {
style = UIAlertControllerStyleAlert;
}else{
style = UIAlertControllerStyleActionSheet;
}
UIAlertController *alertVc = [UIAlertController alertControllerWithTitle:DoraemonLocalizedString(@"请选择操作方式") message:nil preferredStyle:style];
__weak typeof(self) weakSelf = self;
UIAlertAction *previewAction = [UIAlertAction actionWithTitle:DoraemonLocalizedString(@"本地预览") style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
__strong typeof(self) strongSelf = weakSelf;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册