Skip to content

Commit

Permalink
QMUIHelper deviceName unknown device 的逻辑错误
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLice committed Sep 24, 2019
1 parent f7acea7 commit c2cd61e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions QMUIKit/QMUICore/QMUIHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,12 @@ + (NSString *)deviceName {
static NSString *name;
dispatch_once(&onceToken, ^{
NSString *model = [self deviceModel];
if (!model) return @"Unknown Device";
NSDictionary *dic = @{
if (!model) {
name = @"Unknown Device";
return;
}

NSDictionary *dict = @{
// See https://www.theiphonewiki.com/wiki/Models
@"iPhone1,1" : @"iPhone 1G",
@"iPhone1,2" : @"iPhone 3G",
Expand Down Expand Up @@ -423,7 +427,7 @@ + (NSString *)deviceName {
@"AppleTV5,3" : @"Apple TV 4",
@"AppleTV6,2" : @"Apple TV 4K",
};
name = dic[model];
name = dict[model];
if (!name) name = model;
if (IS_SIMULATOR) name = [name stringByAppendingString:@" Simulator"];
});
Expand Down

0 comments on commit c2cd61e

Please sign in to comment.