4

The main File menu for my app has a Share menu, with standard sharing services requested normally through [NSSharingServices sharingServicesForItems:@[self.fileURL]]. It is never called when fileURL is null.

However, this requests outputs the following error:

Could not instantiate class NSURL. Error: Error Domain=NSCocoaErrorDomain Code=4864 
   "value for key 'root' was of unexpected class 'NSNull'. Allowed classes are '{( NSURL )}'."

The only value contained in the array is self.fileURL, which is of class NSURL. The sharing menu itself works with no problem, and the only problem is this strange error in the console. What am I doing wrong and where might this null value come from?

Tritonal
  • 607
  • 4
  • 16
  • Where does `self.fileURL` come from? – Willeke Oct 21 '20 at 08:34
  • See [What are the differences between nil, NULL and \[NSNULL nil\]?](https://stackoverflow.com/questions/6814427/what-are-the-differences-between-nil-null-and-nsnull-nil) – Willeke Oct 21 '20 at 08:34
  • It's a standard document-based app, with `fileURL` pointing to the document location: https://developer.apple.com/documentation/appkit/nsdocument/1515038-fileurl?language=objc – Tritonal Oct 21 '20 at 11:38
  • @Tritonal I have the same problem and I'm not sure if it's related but the share dialog also doesn't immediately appear over the document or appears half-transparent. Not sure if these two things are related. Do you also see this? Were you able to resolve this? – Jacob Gorban Jan 06 '21 at 01:21
  • Unfortunately not. I created a couple of document-based apps from the scratch for testing purposes and had the same behavior, so I'm guessing it's either a bug or an undocumented feature. – Tritonal Jan 06 '21 at 08:49

0 Answers0