From fa8f5475e9588e91eebfd3c0a10c0f663c74e8d2 Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Wed, 9 Sep 2020 13:31:08 +0100 Subject: [PATCH] fix(ios): guard new picker types (#12020) Fixes TIMOB-28112 --- iphone/Classes/TiUIPicker.m | 6 ++++++ iphone/Classes/TiUIiOSProxy.m | 2 ++ iphone/iphone/Titanium_Prefix.pch | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/iphone/Classes/TiUIPicker.m b/iphone/Classes/TiUIPicker.m index e22b61902dc..3d06b5a00a5 100644 --- a/iphone/Classes/TiUIPicker.m +++ b/iphone/Classes/TiUIPicker.m @@ -177,13 +177,19 @@ - (void)setType_:(id)type_ } } +#if IS_SDK_IOS_13_4 - (void)setDatePickerStyle_:(id)style { + if (![TiUtils isIOSVersionOrGreater:@"13.4"]) { + DebugLog(@"setDatePickerStyle is only supported on iOS 13.4 and above"); + return; + } UIControl *picker = [self picker]; if ([self isDatePicker]) { [(UIDatePicker *)picker setPreferredDatePickerStyle:[TiUtils intValue:style]]; } } +#endif // We're order-dependent on type being set first, so we need to make sure that anything that relies // on whether or not this is a date picker needs to be set AFTER the initial configuration. diff --git a/iphone/Classes/TiUIiOSProxy.m b/iphone/Classes/TiUIiOSProxy.m index 78249e50f12..0c30b2719de 100644 --- a/iphone/Classes/TiUIiOSProxy.m +++ b/iphone/Classes/TiUIiOSProxy.m @@ -192,6 +192,7 @@ - (NSNumber *)ROW_ACTION_STYLE_NORMAL #ifdef USE_TI_UIPICKER +#if IS_SDK_IOS_13_4 - (NSNumber *)DATE_PICKER_STYLE_AUTOMATIC { if (![TiUtils isIOSVersionOrGreater:@"13.4"]) { @@ -218,6 +219,7 @@ - (NSNumber *)DATE_PICKER_STYLE_COMPACT return @(UIDatePickerStyleCompact); } +#endif #if IS_SDK_IOS_14 - (NSNumber *)DATE_PICKER_STYLE_INLINE diff --git a/iphone/iphone/Titanium_Prefix.pch b/iphone/iphone/Titanium_Prefix.pch index 572e3f93d7a..3e890d17c10 100644 --- a/iphone/iphone/Titanium_Prefix.pch +++ b/iphone/iphone/Titanium_Prefix.pch @@ -17,6 +17,12 @@ #define IS_SDK_IOS_14 false #endif +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130400 +#define IS_SDK_IOS_13_4 true +#else +#define IS_SDK_IOS_13_4 false +#endif + #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 #define IS_SDK_IOS_13 true #else