Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom UIActivity: Unknown activity items supplied in ios8

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

Unknown activity items supplied: (
    "<InstagramPhoto: 0x18848310>"
)
like image 733
cessmestreet Avatar asked Nov 11 '22 00:11

cessmestreet


1 Answers

I had such error when I passed my view controller object to UIActivityViewController in activity item list without implementing UIActivityItemSource protocol(it doesn't look like requirenment in the documentation).

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

If you have code like above, you should have something like this in InstagramPhoto(godawful code, just to explain):

    - (id)activityViewController:(UIActivityViewController*) activityViewController itemForActivityType:(NSString *)activityType
    {
        return self;
    }

    - (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController
    {
        return @"";
    }
like image 195
Tamara Avatar answered Dec 05 '22 06:12

Tamara