Problems with UIActivityItemProvider after sharing with AirDrop

I use UIActivityViewControllerwith custom subclasses UIActivityItemProvider. My suppliers work perfectly with everyone UIActivityTypeI want to make available, except when the following sequences are executed:

  • Display UIActivityViewController
  • Share with another device using AirDrop
  • After sharing successfully on another device, send an email

The erroneous behavior is that I have a text provider that provides instances NSString, and they do not appear in the subject and body of the message. The expected behavior is that the mail composition dialog should contain the object and body provided by the text provider.

When this sequence is executed, I get the following warnings in the console:

2014-03-27 18: 35: 09.065 TestApp [1347: 60b] Warning - UIActivityItemProvider <MyActivityItemProvider: 0x170296620> is ignored (duplicated, executed, or terminated)

2014-03-27 18: 35: 09.065 TestApp [1347: 60b] Warning - UIActivityItemProvider <TestActivityItemProvider: 0x170480a00> is ignored (duplicated, executed, or terminated)

2014-03-27 18: 35: 09.065 TestApp [1347: 60b] Warning - UIActivityItemProvider <WonderfulActivityItemProvider: 0x1704b7760> is ignored (duplicated, executed, or terminated)

Each of the warnings corresponds to one of UIActivityItemProviderwhich I have provided. Inside these providers, the method - (id)itemis implemented as follows:

- (id)item
{
    if ([self.activityType isEqualToString:UIActivityTypeMail]) {
        return @"MyMailString";
    }
    return @""; // placeholder item
}

, Facebook, Twitter, Mail .. AirDrop PDF - . AirDrop UIActivityViewController, "" AirDrop. !

+4

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


All Articles