Apple Docs say that you can use the UIActivityItemSource
protocol to customize messages shared with the UIActivityViewController
in lieu of a UIActivityItemProvider
Object:
UIActivityItemSource
You can use this protocol in situations where you want to provide the data from one of your app’s existing objects instead of creating a separate UIActivityItemProvider object.
I have adopted this protocol, however, the delegate methods such as the one below do not seem to be firing. Can anyone confirm this should work and, if so, point me toward what I might be missing? Thanks in advance for any suggestions.
-(NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(UIActivityType)activityType
{
NSLog(@"DELEGATE METHOD CALLED");//Not logging to console
if (activityType == UIActivityTypeMessage) {
return @"My message";
} else if (activityType == UIActivityTypeMail) {
return @"My email text";
}
else {
return @"My default text";
}
}
Yes, this delegate method works for me, and the delegate method is called. I create the activity item controller with the following code:
where
self
implementsUIActivityItemSource
.