UIDocumentBrowserViewController.h missing API_AVAILABLE(ios(11.0)) for UIDocumentBrowserViewControllerDelegate

Originator:robbert
Number:rdar://33774557 Date Originated:August 8 2017
Status:Resolved Resolved:Xcode 9
Product:iOS + SDK Product Version:Xcode 9 beta 5
Classification:Bug Reproducible:Always
 
Area:
UIKit

Summary:
SwiftC commands fail because "warning: 'UIDocumentBrowserViewController' is partial: introduced in iOS 11.0" when target is set < iOS 11.

Steps to Reproduce:
cd $(mktemp -d)
echo "import UIKit" > test.swift
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -target x86_64-apple-ios8.0 -c -o . -parse-as-library -module-cache-path ModuleCache test.swift -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks

Expected Results:
Builds always succeed

Observed Results:
Builds fail the first time and succeed the second

```
module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/UIKit.h"
        ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:267:9: note: in file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:267:
#import <DocumentManager/DocumentManager.h>
        ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/Frameworks/DocumentManager.framework/Headers/DocumentManager.h:10:9: note: in file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/Frameworks/DocumentManager.framework/Headers/DocumentManager.h:10:
#import <DocumentManager/UIDocumentBrowserViewController.h>
        ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/Frameworks/DocumentManager.framework/Headers/UIDocumentBrowserViewController.h:105:26: error: 'UIDocumentBrowserViewController' is partial: introduced in iOS 11.0
- (void)documentBrowser:(UIDocumentBrowserViewController *)controller didPickDocumentURLs:(NSArray <NSURL *> *)documentURLs;
                         ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/Frameworks/DocumentManager.framework/Headers/UIDocumentBrowserViewController.h:39:12: note: 'UIDocumentBrowserViewController' has been explicitly marked partial here
@interface UIDocumentBrowserViewController : UIViewController <NSCoding>
           ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/Frameworks/DocumentManager.framework/Headers/UIDocumentBrowserViewController.h:105:1: note: annotate 'documentBrowser:didPickDocumentURLs:' with an availability attribute to silence
- (void)documentBrowser:(UIDocumentBrowserViewController *)controller didPickDocumentURLs:(NSArray <NSURL *> *)documentURLs;
^
```

Version:
Xcode 9 beta 5

Notes:
Note that if you remove the "-F /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks" part of the swiftc command, the compilation would succeed on the first try.

Changing the header in question to add the availability macro makes the issue go away:
--- a/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/Frameworks/DocumentManager.framework/Headers/UIDocumentBrowserViewController.h
+++ b/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework/Frameworks/DocumentManager.framework/Headers/UIDocumentBrowserViewController.h
@@ -95,7 +95,8 @@ API_AVAILABLE(ios(11.0)) __TVOS_UNAVAILABLE


#pragma mark -
-__TVOS_UNAVAILABLE @protocol UIDocumentBrowserViewControllerDelegate <NSObject>
+API_AVAILABLE(ios(11.0)) __TVOS_UNAVAILABLE
+@protocol UIDocumentBrowserViewControllerDelegate <NSObject>

@optional

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!