saucewipe saucewipe - 1 year ago 201
iOS Question

Implementing the UIActivityItemSource protocol

I have these protocol methods,


but they never get called. How do I tell the
to call them?

I also have an
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. :)

Answer Source

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.