I have these protocol methods,
activityViewControllerPlaceholderItem:
and activityViewController:itemForActivityType:
but they never get called. How do I tell the UIActivityViewController
to call them?
I also have an UIActivityItemProvider
subclass, however I'm confused as to who calls these 2 methods. I'd really appreciate some sample code, as I can't find anything on the web. :)
According to the documentation. The array of activity items that you pass to
-initWithActivityItems:applicationActivities:
can be an array of data objects, like strings or images, or it can be array of objects that implement the UIActivityItemSource
protocol.
If you pass an array of objects that implement the UIActivityItemSource
protocol then your instance of UIActivityViewController
will call those methods on your activity items. Those objects do not necessarily have to be subclasses of UIActivityItemProvider
. UIActivityItemProvider
is just a class that conforms to this protocol.