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"
)}