[iOS] Replace deprecated -[UIDocumentMenuViewController
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Jan 2016 19:03:08 +0000 (19:03 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Jan 2016 19:03:08 +0000 (19:03 +0000)
_setIgnoreApplicationEntitlementForImport:]

<https://bugs.webkit.org/show_bug.cgi?id=145690>
<rdar://problem/20636577>

Reviewed by Brent Fulgham.

* Platform/spi/ios/UIKitSPI.h:
Replace deprecated SPI with newer SPI.

* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel presentWithParameters:resultListener:]):
(-[WKFileUploadPanel _showDocumentPickerMenu]):
Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195171 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Platform/spi/ios/UIKitSPI.h
Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm

index 6d34597..7e9915a 100644 (file)
@@ -1,3 +1,21 @@
+2016-01-16  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        [iOS] Replace deprecated -[UIDocumentMenuViewController
+        _setIgnoreApplicationEntitlementForImport:]
+
+        <https://bugs.webkit.org/show_bug.cgi?id=145690>
+        <rdar://problem/20636577>
+
+        Reviewed by Brent Fulgham.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        Replace deprecated SPI with newer SPI.
+
+        * UIProcess/ios/forms/WKFileUploadPanel.mm:
+        (-[WKFileUploadPanel presentWithParameters:resultListener:]):
+        (-[WKFileUploadPanel _showDocumentPickerMenu]):
+        Ditto.
+
 2016-01-16  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         [GTK] Unreviewed. Fix a typo in an API comment.
index 34c707d..1b8fcf2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -83,7 +83,7 @@
 #import <UIKit/UIDocumentMenuViewController_Private.h>
 #else
 @interface UIDocumentMenuViewController ()
-@property (nonatomic, assign, setter = _setIgnoreApplicationEntitlementForImport:, getter = _ignoreApplicationEntitlementForImport) BOOL _ignoreApplicationEntitlementForImport;
+- (instancetype)_initIgnoringApplicationEntitlementForImportOfTypes:(NSArray *)types;
 @end
 #endif
 
@@ -763,7 +763,7 @@ typedef enum {
 @end
 
 @interface UIDocumentMenuViewController ()
-@property (nonatomic, assign, setter = _setIgnoreApplicationEntitlementForImport:, getter = _ignoreApplicationEntitlementForImport) BOOL _ignoreApplicationEntitlementForImport;
+- (instancetype)_initIgnoringApplicationEntitlementForImportOfTypes:(NSArray *)types;
 @end
 
 @protocol UIDocumentPasswordViewDelegate;
index f80de02..9884b39 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -375,7 +375,7 @@ static UIImage* iconForFile(NSURL *file)
     _mimeTypes = adoptNS([mimeTypes copy]);
 
     // FIXME: Remove this check and the fallback code when a new SDK is available. <rdar://problem/20150072>
-    if ([UIDocumentMenuViewController instancesRespondToSelector:@selector(_setIgnoreApplicationEntitlementForImport:)]) {
+    if ([UIDocumentMenuViewController instancesRespondToSelector:@selector(_initIgnoringApplicationEntitlementForImportOfTypes:)]) {
         [self _showDocumentPickerMenu];
         return;
     }
@@ -515,14 +515,7 @@ static NSArray *UTIsForMIMETypes(NSArray *mimeTypes)
 - (void)_showDocumentPickerMenu
 {
     // FIXME: Support multiple file selection when implemented. <rdar://17177981>
-    // FIXME: We call -_setIgnoreApplicationEntitlementForImport: before initialization, because the assertion we're trying
-    // to suppress is in the initializer. <rdar://problem/20137692> tracks doing this with a private initializer.
-    _documentMenuController = adoptNS([UIDocumentMenuViewController alloc]);
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-    [_documentMenuController _setIgnoreApplicationEntitlementForImport:YES];
-#pragma clang diagnostic pop
-    [_documentMenuController initWithDocumentTypes:[self _documentPickerMenuMediaTypes] inMode:UIDocumentPickerModeImport];
+    _documentMenuController = adoptNS([[UIDocumentMenuViewController alloc] _initIgnoringApplicationEntitlementForImportOfTypes:[self _documentPickerMenuMediaTypes]]);
     [_documentMenuController setDelegate:self];
 
     [_documentMenuController addOptionWithTitle:[self _photoLibraryButtonLabel] image:photoLibraryIcon() order:UIDocumentMenuOrderFirst handler:^{