diff --git a/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m b/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m index e28a5ed0..4606a97d 100644 --- a/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m +++ b/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m @@ -62,13 +62,25 @@ - (instancetype)init { if (TARGET_OS_SIMULATOR == 1) { platform = [NSProcessInfo new].environment[@"SIMULATOR_MODEL_IDENTIFIER"]; } + + UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; + CGFloat screenWidth; + CGFloat screenHeight; + if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) { + screenWidth = [[UIScreen mainScreen] bounds].size.width; + screenHeight = [[UIScreen mainScreen] bounds].size.height; + } else { + screenWidth = [[UIScreen mainScreen] bounds].size.height; + screenHeight = [[UIScreen mainScreen] bounds].size.width; + } + _innerEnvironmentDictionary = @{ @"platform": @"iOS", @"platformVersion": [[UIDevice currentDevice] systemVersion], @"appName": infoDictionary[@"CFBundleName"], @"appVersion": infoDictionary[@"CFBundleShortVersionString"], - @"screenWidth": @([[UIScreen mainScreen] bounds].size.width), - @"screenHeight": @([[UIScreen mainScreen] bounds].size.height), + @"screenWidth": @(screenWidth), + @"screenHeight": @(screenHeight), @"screenScale": @([[UIScreen mainScreen] scale]), @"statusBarHeight": @([[UIApplication sharedApplication] statusBarFrame].size.height), @"hasNotch": @(hasNotch()),