I am using subclass of UIActivityViewController to show custom UIActivities.
When Controller is showing, I am getting
Unknown activity items supplied: (
"<MyClass: somehash>"
)
in my logs.
MyClass subclasses NSObject and is passed to new ViewController invoked by tap on my UIActivity.
I tried to implement protocol UIActivityItemSource on MyClass, but it didn't solve the problem.
MyClass object is passed in array to [UIActivityViewController init] as activityItems parameter, and it shouldn't be a problem, as documentation says only:
The array of data objects on which to perform the activity. The type of objects in the array is variable and dependent on the data your application manages. For example, the data might consist of one or more string or image objects representing the currently selected content.
Edit:
This is the code I can share:
MyClass *myDataObject = some data...
...
NSMutableArray *activityItems = [NSMutableArray arrayWithCapacity:3];
[activityItems addObject:NSLocalizedString(@"default_activity_message", nil)];
[activityItems addObject:someURL];
[activityItems addObject:myDataObject];
NSMutableArray *customActivities = [NSMutableArray arrayWithCapacity:1];
[customActivities addObject:[MyActivity new]];
MyActivityViewController *activityViewController =
[[MyActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:customActivities];
[self presentViewController:activityViewController animated:YES completion:nil];