diff --git a/Sources/VLCAppDelegate.m b/Sources/VLCAppDelegate.m index f0958104c86906a325920d0cc122d1a5acc1a552..ccac936ae669596058a4ed7bbd1ab4eba109839b 100644 --- a/Sources/VLCAppDelegate.m +++ b/Sources/VLCAppDelegate.m @@ -173,7 +173,7 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize } /* add our static shortcut items the dynamic way to ease l10n and dynamic elements to be introduced later */ - if ([UIApplicationShortcutItem class] != nil) { + if (@available(iOS 9, *)) { if (application.shortcutItems == nil || application.shortcutItems.count < 4) { UIApplicationShortcutItem *localLibraryItem = [[UIApplicationShortcutItem alloc] initWithType:kVLCApplicationShortcutLocalLibrary localizedTitle:NSLocalizedString(@"SECTION_HEADER_LIBRARY",nil) diff --git a/Sources/VLCCloudServicesTableViewController.m b/Sources/VLCCloudServicesTableViewController.m index 3f759569df47ef54782af68bb6266a4750a6597f..dddda7c8ce7dee7ac4ecc1777d716299493efd28 100644 --- a/Sources/VLCCloudServicesTableViewController.m +++ b/Sources/VLCCloudServicesTableViewController.m @@ -75,7 +75,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [UIDocumentPickerViewController class] ? 5 : 4;// on iOS 8+ add document picker option + return @available(iOS 8.0, *) ? 5 : 4; // on iOS 8+ add document picker option } - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath diff --git a/Sources/VLCDocumentPickerController.m b/Sources/VLCDocumentPickerController.m index 5c318cba77d2a122e56a0d3e432113f915118a07..9470f8b072aee4cfbda22394da9780f141e45544 100644 --- a/Sources/VLCDocumentPickerController.m +++ b/Sources/VLCDocumentPickerController.m @@ -25,7 +25,7 @@ - (void)showDocumentMenuViewController:(id)sender { - if (![UIDocumentMenuViewController class]) + if (!@available(iOS 8, *)) return; UIDocumentMenuViewController *importMenu = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[(id)kUTTypeAudiovisualContent] inMode:UIDocumentPickerModeImport]; diff --git a/Sources/VLCFrostedGlasView.m b/Sources/VLCFrostedGlasView.m index 2cde1106567ebc6a00168070043c3101d9d11b3f..2e5353d0be7261c003e503998c06a672b5b2bb8f 100644 --- a/Sources/VLCFrostedGlasView.m +++ b/Sources/VLCFrostedGlasView.m @@ -52,7 +52,7 @@ [self setClipsToBounds:YES]; #if TARGET_OS_IOS - if ([UIVisualEffectView class] != nil) { + if (@available(iOS 8, *)) { _effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]]; _effectView.frame = self.bounds; _effectView.clipsToBounds = YES; diff --git a/Sources/VLCLibraryViewController.m b/Sources/VLCLibraryViewController.m index a3be83c9ab4d751e4d9061314341ccf81e876576..a0921447049d37ff82c14de0d3fa2408471acddc 100644 --- a/Sources/VLCLibraryViewController.m +++ b/Sources/VLCLibraryViewController.m @@ -342,7 +342,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData"; - (void)createSpotlightItem:(nonnull NSManagedObject *)mediaObject { - if ([CSSearchableItemAttributeSet class] != nil && ![VLCKeychainCoordinator passcodeLockEnabled]) { + if (@available(iOS 9.0, *) && ![VLCKeychainCoordinator passcodeLockEnabled]) { self.userActivity = [[NSUserActivity alloc] initWithActivityType:kVLCUserActivityPlaying]; MLFile *file = nil; @@ -1102,7 +1102,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData"; NSArray *indexPaths = [self usingTableViewToShowData] ? [self.tableView indexPathsForSelectedRows] : [self.collectionView indexPathsForSelectedItems]; if ((!indexPaths || [indexPaths count] == 0) && !_deleteFromTableView) { - if ([UIAlertController class]) { + if (@available(iOS 8, *)) { UIAlertController *invalidSelection = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"DELETE_INVALID_TITLE", nil) message:NSLocalizedString(@"DELETE_INVALID_MESSAGE", nil) preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *doneAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BUTTON_OK", nil) style:UIAlertActionStyleDefault handler:nil]; diff --git a/Sources/VLCOpenNetworkStreamViewController.m b/Sources/VLCOpenNetworkStreamViewController.m index a9d44a78f4d46722192fe31d83b475ce610292ea..b7ed85cef20295f6f6886ebb202c734c2b2f9fcd 100644 --- a/Sources/VLCOpenNetworkStreamViewController.m +++ b/Sources/VLCOpenNetworkStreamViewController.m @@ -201,7 +201,7 @@ NSString *renameString = NSLocalizedString(@"BUTTON_RENAME", nil); NSString *cancelString = NSLocalizedString(@"BUTTON_CANCEL", nil); - if ([UIAlertController class]) + if (@available(iOS 8, *)) { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:renameString message:nil diff --git a/Sources/VLCThumbnailsCache.m b/Sources/VLCThumbnailsCache.m index ebad9d78759b687e092bc7a8bbfc95d690795f21..3515de7f6cc696cfee42d2da51fe7fd985875303 100644 --- a/Sources/VLCThumbnailsCache.m +++ b/Sources/VLCThumbnailsCache.m @@ -293,7 +293,7 @@ } else #endif { - if ([WKInterfaceDevice class]) { + if (@available(iOS 8.2, *)) { if (WKInterfaceDevice.currentDevice != nil) { CGRect screenRect = WKInterfaceDevice.currentDevice.screenBounds; imageSize = CGSizeMake(screenRect.size.width * WKInterfaceDevice.currentDevice.screenScale, 120.); diff --git a/Sources/VLCWatchCommunication.m b/Sources/VLCWatchCommunication.m index 4b5bcda3ab948a94b2fad66e498df6404bdf75fc..65a9911385bcf5e06e221fa10708be4e883aace3 100644 --- a/Sources/VLCWatchCommunication.m +++ b/Sources/VLCWatchCommunication.m @@ -27,7 +27,7 @@ @implementation VLCWatchCommunication + (BOOL)isSupported { - return [WCSession class] != nil && [WCSession isSupported]; + return @available(iOS 9, *) && [WCSession isSupported]; } - (instancetype)init