Once my share extension is loaded, not everytime and not everything is visible for user immediately. The most common is that there you can see image, number of images, and content text. However there are cases where there is a lot more informations.
- How to get access to them?
I know that within SLComposeServiceViewController
there is extensionContext
and its inputItems
property.
Ok, so I stopped the debugger at time, and print out on console some things with following command:
po (extensionContext!.inputItems[0] as! NSExtensionItem).userInfo![NSExtensionItemAttachmentsKey]
- Is it correct way to do this?
- Is there usually one input item?
there was two NSItemProvider
objects as attachments to first NSExtensionItem
Ok, then I print out the first of attachments:
- How to get that image from that
NSItemProvider
and url from the next one? Can you deliver some code?
I suppose we will use
loadItemForTypeIdentifier(_:options:completionHandler:)
but do not know how.