-[NSExtensionContext completeRequestReturningItems:completionHandler:] does not return items from Document Provider Extension

Originator:davidz
Number:rdar://18067493 Date Originated:August 19, 2014
Status:Open Resolved:
Product:iOS SDK Product Version:8.0b5
Classification: Reproducible:Yes
 
Summary:
From the UIDocumentPickerExtensionViewController, -[NSExtensionContext completeRequestReturningItems:completionHandler:] dismisses the document provider UI but does not return any items to the host app.

While UIDocumentPickerExtensionViewController has a dismissGrantingAccessToURL: method, this NSExtensionContext method is important because this method provides a completion handler block argument which is necessary for cleanup.

Steps to Reproduce:
Step 1: call the following code from a UIDocumentPickerExtensionViewController.

NSURL *path = ...;
NSExtensionItem *item = [NSExtensionItem new];
item.attributedTitle = [[NSAttributedString alloc] initWithString:path.lastPathComponent];
item.attachments = @[[[NSItemProvider alloc] initWithContentsOfURL:path]];
[self.extensionContext completeRequestReturningItems:@[item] completionHandler:^(BOOL expired) {
    NSLog(@"In beta 5, this does get executed");
}];


Expected Results:
1. The document provider extension is dismissed
2. The URL is passed to the host app, which can then open the file
3. The completion handler is called

Actual Results:
The document provider extension is dismissed and the completion handler is called, but the host app's documentPickerWasCancelled: is invoked rather than documentPicker:didPickDocumentAtURL:.

Version:
iOS 8.0 (12A4345d)

Notes:


Configuration:
iPhone

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!