There is a extremely similar question asked by the following post: Different data for sharing providers in UIActivityViewController. But my question is different.
I know how to share different different data of the same type with different activities by using itemForActivityType
. For example:
- (id) activityViewController:(UIActivityViewController *)activityViewController
itemForActivityType:(NSString *)activityType
{
if ( [activityType isEqualToString:UIActivityTypePostToTwitter] )
return @"This is a #twitter post!";
if ( [activityType isEqualToString:UIActivityTypePostToFacebook] )
return @"This is a facebook post!";
if ( [activityType isEqualToString:UIActivityTypeAirDrop] )
return @"Airdrop message text";
else
return nil;
}
However, my question is: what if I have different kind of data to share with different activities, what should I do?. For example, what if I would like to share:
- a string on Twitter;
- a array of an string and and image on Facebook;
- the actual data of the image (e.g. NSData) with Airdrop.
P.S.:
I also looked at the following protocol function:
- (id)activityViewControllerPlaceholderItem:;
However, I cannot use it because we don't know the value of activityType
here.