-(void)viewDidLoad {
[super viewDidLoad];
NSExtensionItem *item = self.extensionContext.inputItems[0];
NSItemProvider *itemProvider = item.attachments[0];
NSLog(@"%@",itemProvider);
if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypePlainText])
{
[itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypePlainText options:nil completionHandler:^(NSString *item, NSError *error)
{
if (item)
{
textString=item;
}
}];
}
I am using share extension in my app. I am using it as a subclass of a UIViewController not SLcomposer.In the viewDidLoad i am trying to access the text in the page from NSItemProvider
,But it has only one key which is public url , Can anybody give me an idea of how to achieve the kUTTypePlainText
in NSItemProvider
. I also set NSExtensionActivationSupportsText, its type to Boolean, and the value to YES