Re: NSFIleManager enumeratorAtPath problem


 



On Jun 15, 2019, at 5:27 PM, leo.r@... wrote:

May I also suggest to submit it as a bug to Apple.
That is, if a function fails because of sandboxing then it shouldn't just fail silently. There should be a clear error or exception: The operation cannot be performed because sandboxing is enabled.

The OP was calling -[NSFileManager enumeratorAtPath:], which is an old API that predates NSError, so failing silently is all it can do. (Cocoa APIs do not throw exceptions except in the case of programmer errors like assertion failures.)

For this reason there is a newer method, -[enumeratorAtURL:…], which does return errors. If the OP had been using that API they'd have gotten an error. IMO the old method should have been deprecated years ago.

Otherwise, Apple once again stabs developers in the back with its pseudo-security mumbo-jumbo.

In what way is it "pseudo" security or "mumbo-jumbo" to restrict access to the user's files? If I download some little app from an unknown developer to batch-resize JPEGs, then I really don't want it to have access to all of my emails, or my tax returns, or even to photos that I didn't explicitly tell it to resize.

If you think those are far-fetched examples, take a look at the kind of privacy nightmares that happen with Android apps. There are many instances of innocent-seeming apps on the Google Play store that slurped up people's private information and uploaded it to the developers' servers. 

Or worse, consider the spread of ransomware on Windows.

—Jens

Join cocoa@apple-dev.groups.io to automatically receive all group messages.