Post

Replies

Boosts

Views

Activity

Why does @available not work?
Hi, I'm trying to build a react native project on Xcode 10.1 with IOS 12.1. I am using Mac OS 10.13.6 (hence the old Xcode). Whenever I build it, these errors appear regarding the @available(iOS 13.0, *) condition. The path to the below error: Pods > Development Pods > react-native-maps > AIRMAP.m > -setUserInterfaceStyle: - (void)setUserInterfaceStyle:(NSString*)userInterfaceStyle {   if (@available(iOS 13.0, *)) {     if([userInterfaceStyle isEqualToString:@"light"]) {       self.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;     } else if([userInterfaceStyle isEqualToString:@"dark"]) {       self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;     } else {       self.overrideUserInterfaceStyle = UIUserInterfaceStyleUnspecified;     }   } else {     NSLog(@"UserInterfaceStyle not supported below iOS 13");   } } I understand why it is failing, properties such as overrideUserInteraceStyle don't exist pre IOS 13 dark mode. However, I don't understand why the @available tag is not preventing Xcode from entering that code block. I have tried New Build & Legacy Build. I have set the project format to Xcode 10.0-compatible. Xcode 9.4+ should support @available. How can I resolve this error on Xcode (other than by commenting it out)?
1
0
579
Nov ’22