NSItemProvider loadItemForTypeIdentifier never completes on iOS 11 GM

This worked in previous iOS 11 betas, and had been working since iOS 9, but does not seem to work in the iOS 11 GM.


From an Action Extension sending content from Notes.app:


    for (NSExtensionItem *item in self.extensionContext.inputItems) {
        for (NSItemProvider *itemProvider in item.attachments) {
            if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeText]) {
                NSLog(@"%@", itemProvider);
                [itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeText options:nil completionHandler:^(NSString *string, NSError *error) {
                    NSLog(@"Loaded");
                }];
            }
        }
    }


This finds the itemProvider, but never hits the completion block.


2017-09-14 09:06:35.489479+0800 Action[4040:691847] <NSItemProvider: 0x13fe0e560> {types = (
    "public.plain-text"
)}

You may have already found this but your answer is probably here: https://stackoverflow.com/questions/32525448/ios-share-extension-not-getting-the-image


You are probably calling

[self.extensionContext completeRequestReturningItems:@[] completionHandler:nil];


before you should.


I had a similar problem, I got away with it until IOS 11.

Thanks for pointing that out, as it turns out it wasn't the issue.


I created a new extension and cut and pasted the code, and it resolved the issue. I presume it was some setting in the target that caused the issue.

NSItemProvider loadItemForTypeIdentifier never completes on iOS 11 GM
 
 
Q