UIActivityItemsConfigurationReading with _uinsApplicationActivityProxies unrecognized selector

With first macOS Catalina version, I have implemented NSSharingServicePickerToolbarItem but after macOS 10.15.1 update this don't work anymore.

I have implemented MasterViewController as activityItemConfiguration conforming UIActivityItemsConfigurationReading protocol.

Error trace

Code Block C
2020-06-19 10:38:29.655949+0200 WhatsHappen[11969:112649] [General] -[WhatsHappen.MasterViewController _uinsApplicationActivityProxies]: unrecognized selector sent to instance 0x100e1ab00
2020-06-19 10:38:29.656468+0200 WhatsHappen[11969:112649] [General] (
0   CoreFoundation                      0x00007fff3744abe7 exceptionPreprocess + 250
1   libobjc.A.dylib                     0x00007fff702225bf objc_exception_throw + 48
2   CoreFoundation                      0x00007fff374c9c77 -[NSObject(NSObject) retain_OA] + 0
3   UIKitCore                           0x00007fff788e0c80 -[UIResponder doesNotRecognizeSelector:] + 310
4   CoreFoundation                      0x00007fff373af44b _forwarding_ + 1427
5   CoreFoundation                      0x00007fff373aee28 _CF_forwarding_prep_0 + 120
6   UIKitMacHelper                      0x00007fff6866bb5e UINSConfigureSharingToolbarItemWithActivityItemsConfiguration + 286
7   UIKitCore                           0x00007fff7884b9ef -[NSSharingServicePickerToolbarItem(UIActivityItemsConfiguration) setActivityItemsConfiguration:] + 56


Implementation

  1. Share item configuration

Code Block Swift
let shareItem = NSSharingServicePickerToolbarItem(itemIdentifier: .share)
            guard let splitViewController = rootViewController else { return nil }
            guard let navigationController = splitViewController.viewControllers.first as? UINavigationController else { return nil }
            guard let masterViewController = navigationController.topViewController as? MasterViewController else { return nil }
            shareItem.activityItemsConfiguration = masterViewController
            return shareItem


2. Protocol conforming
Code Block Swift
extension MasterViewController: UIActivityItemsConfigurationReading {
    var itemProvidersForActivityItemsConfiguration: [NSItemProvider] {
        if let selected = tableView.indexPathForSelectedRow, let articles = fetchedResultsController.fetchedObjects {
            return [articles[selected.row].itemProvider]
        }
        return []
    }
}

3. Item provider
Code Block Swift
var itemProvider: NSItemProvider { NSItemProvider(object: link as NSURL? ?? NSURL()) }


There appears to be a bug where you are unable to use an object that implements UIActivityItemsConfigurationReading to satisfy the share sheet.

You must set a UIResponder’s in the responder chain or the NSToolbarItem’s activityItemsConfiguration to an instance of UIActivityItemsConfiguration
Unfortunately, this is a known error in our implementation. You must use an instance of UIActivityItemsConfiguration to avoid this exception.

This error has been corrected in Big Sur.
UIActivityItemsConfigurationReading with _uinsApplicationActivityProxies unrecognized selector
 
 
Q