0

I am working on a File Provider Extension for my iOS application. Everything is mostly working, except when I try to save the file to the disk it keeps returning this error:

Error Domain=NSPOSIXErrorDomain Code=2 "couldn't issue sandbox extension com.apple.app-sandbox.read-write for '/Users/Dlabs/Library/Developer/CoreSimulator/Devices/57330867-0570-46C8-8127-CAF8FE9F23A6/data/Containers/Shared/AppGroup/2F5EBE63-6FE5-47AE-BA55-BE47C5ED3FB1/File Provider Storage/0DCCF3F0-083A-4CBB-8C97-E98917DE8C53.jpg/0DCCF3F0-083A-4CBB-8C97-E98917DE8C53.jpg': No such file or directory"

The part that has me stumped is:

couldn't issue sandbox extension com.apple.app-sandbox.read-write

And everytime I google for this error it returns links to Apple, like this one:

https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html

Which explicitly say:

Note: This chapter describes property list keys specific to the macOS implementation of App Sandbox. They are not available in iOS.

Does anybody have experience adding this entitlement?

Asleepace
  • 3,466
  • 2
  • 23
  • 36

1 Answers1

1

Ok so it turns out this had nothing to do with entitlements, but rather how I was trying to create a directory in the sandbox.

Originally did this:

[_fileManager createDirectoryAtPath:[[url URLByDeletingLastPathComponent] absoluteString]
        withIntermediateDirectories:true attributes:nil error:&dirError];

Should have been done like this:

[_fileManager createDirectoryAtURL:[url URLByDeletingLastPathComponent]
       withIntermediateDirectories:true attributes:nil error:&dirError];

Notice the difference between createDirectoryAtPath and createDirectoryAtURL

Anyways hope this helps someone in the future!

Asleepace
  • 3,466
  • 2
  • 23
  • 36
  • do you have any idea about this? https://stackoverflow.com/questions/48783317/apple-fileprovider-extention-in-file-application-remove-copy-duplicate-operatio – jignesh Vadadoriya Feb 15 '18 at 04:11
  • @jigneshVadadoriya I don’t see those options on mine, is it ok if I take a look at let you know tomorrow? – Asleepace Feb 15 '18 at 04:53
  • yeah sure it's great help from your side to me – jignesh Vadadoriya Feb 15 '18 at 04:57
  • @jigneshVadadoriya hey sorry it's been a while, I haven't found out what causes those options, but I think it may be the file provider extension UI. I don't have that in my app and those options don't seem to appear. Hope that helps! – Asleepace Feb 20 '18 at 01:12