Sharing folder via NSSharingServicePicker on macOS 13 to iOS device

178 views Asked by At

Within my app I am using NSSharingServicePicker to share exports. This all works fine on macOS 11 and macOS 12. On macOS 13 though there is a strange issue sharing folders to e.g. an iOS device running iOS 15 or iOS 16. This is not an issue sharing e.g. a pdf document, only when sharing a folder:

let picker = NSSharingServicePicker(items: [exportURL])
picker.delegate = self
picker.show(relativeTo: myShareButton.bounds, of: myShareButton, preferredEdge: .maxY)

The picker shows up and I can successfully share the folder to mail, Notes.app or whatever. Sharing via AirDrop to an iOS device though ends up with an empty folder on the device.

As said above, this is not an issue on macOS 11 and macOS 12.

Any ideas on that?

1

There are 1 answers

0
berbie On

Just found out that if I repackage the URL into a fileSytemURL it works as expected. This is a bug but still I do not understand why the system makes a difference on these two representations of the same thing.

let wrappedURL = URL(fileURLWithPath: (exportURL as NSURL).fileReferenceURL()!.path)
let picker = NSSharingServicePicker(items: [wrappedURL])
picker.delegate = self
picker.show(relativeTo: myShareButton.bounds, of: myShareButton, preferredEdge: .maxY)