Custom UIActivity: unknown activity items introduced in ios8

I created a custom UIActivity for Instagram. One of the activity elements that I need for my custom UIActivity is an instance of InstagramPhoto. This object contains a UIImage, title and other materials that I want to send to instagram app. With ios below 8, everything works fine. But when I test using ios8, I see this error:

Unknown activity items supplied: ( "<InstagramPhoto: 0x18848310>" ) 
+5
source share
1 answer

I had such an error when I passed the view controller object to the UIActivityViewController in the list of activity elements without implementing the UIActivityItemSource protocol (it does not look like the requirement in the documentation).

  UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[self] applicationActivities:customActivities]; 

If you have the code as above, you should have something like this in InstagramPhoto (divine code, just for explanation):

  - (id)activityViewController:(UIActivityViewController*) activityViewController itemForActivityType:(NSString *)activityType { return self; } - (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController { return @""; } 
+1
source

Source: https://habr.com/ru/post/1204546/


All Articles