在百度上找了好久,发现都是一个Copy一个,没一个实质性解决问题的.
正常创建和配置APP Extension Share TARGETS 这里就不讲了,百度整个第一页都是,随便看.
NSExtensionItem* extensionItem = [self.extensionContext.inputItems firstObject];
NSItemProvider* extensionItemProvider;
NSInteger attachmentsCount = [extensionItem attachments].count;
if(attachmentsCount ==1) {
extensionItemProvider = [[extensionItem attachments] firstObject];
}else{
extensionItemProvider = [[extensionItem attachments] objectAtIndex:1];
}
if([extensionItemProvider hasItemConformingToTypeIdentifier:(NSString*) kUTTypeURL]) {
[extensionItemProvider loadItemForTypeIdentifier:(NSString*)kUTTypeURL options:nil completionHandler:^(NSURL* Url,NSError*error) {
}
}
分享到safari的数据都放在了
NSItemProvider = [[ NSExtensionItem attachments] firstObject;]
这里
分享到其他浏览器的的数据都放在了
NSItemProvider = [[ NSExtensionItem attachments] objectAtIndex;1];
这里.