Sdk access to filemanager documents directory

Not sure if my question is weird or not, but I didnt find any documentation about an sdks access to an apps documents directory.

Im assuming that because sdk is part of the sandbox that it can access and read from the documents directory? i.e. if i used

NSFileManager.defaultManager.URLForDirectory(
        directory = NSCachesDirectory,
        inDomain = NSUserDomainMask,
        appropriateForURL = null,
        create = false,
        error = null,
    )

to write a file called "file.txt", then any sdk my app used has the ability to access the contents of said directory?

If yes, why isnt this considered something more worth mentioning? usually in filemanager tutorials they never warn about this.

FYI: Im asking more for iOS and iPadOs then MacOs.

Answered by DTS Engineer in 821390022

Like Etresoft, I’m not sure I fully understand your point here. However, I want to be very clear about one thing: If you integrate third-party code within your app — for example, a third-party SDK that you statically or dynamically link to — then:

  • That code runs with all the privileges of your app. It can access files in your app’s container, utilises privileges granted to your app by the user in Settings > Privacy & Security, and so on.

  • From an App Review perspective, you are responsible for the behaviour of that code.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I don't understand your question. When you say "SDK", are you referring to a bundled framework or dylib?

I don't understand why any warning would be necessary.

Also, you mention the "Documents" directory but then your code mentions the caches directory. Which are you asking about?

Or perhaps you are thinking of a "Documents" directory outside of the app's sandbox? That's only on macOS and only for non-sandboxed apps. Sandboxed apps live in their own little world - the sandbox.

Like Etresoft, I’m not sure I fully understand your point here. However, I want to be very clear about one thing: If you integrate third-party code within your app — for example, a third-party SDK that you statically or dynamically link to — then:

  • That code runs with all the privileges of your app. It can access files in your app’s container, utilises privileges granted to your app by the user in Settings > Privacy & Security, and so on.

  • From an App Review perspective, you are responsible for the behaviour of that code.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It’s better if you reply as a reply, rather than in the comments. See Quinn’s Top Ten DevForums Tips for this and other tips.

we share the same file system right

Yes. That’s what I meant by “your app’s container”.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I get that sdk code is our responsibility, but the fact is, people dont know that the app shares the same sandbox as the sdk and so they might not know to consider that before adopting an sdk. or consider that when they make new files in the filesystem.

This seems like an issue to me.

I get that sdk code is our responsibility, but the fact is, people dont know that the app shares the same sandbox as the sdk and so they might not know to consider that before adopting an sdk. or consider that when they make new files in the filesystem.

I think you're greatly over-estimating the amount of research that the average developer does before incorporating 3rd party frameworks. That's why Apple added the requirement for Privacy Manifests when using certain frameworks.

You're certainly correct that this could be an issue if the developer didn't understand. But there's no coding or knowledge test required before being allowed to distribute apps.

I am not concerned for Apple's sake, I am concerned for the developer's application's sake, and the sdk developer's sake. Developers shouldn't just assume that the OS has every thing taken care of for them. And the Sdk developer might not know either so they do risky things. Then the app has mysterious bugs. @Etresoft

But there's no coding or knowledge test required before being allowed to distribute apps.

true.dat

Developers shouldn't just assume that the OS has every thing taken care of for them.

Agreed. If you have concrete suggestions for how Apple should help educate developers on that point, I encourage you to file one or more enhancement requests against the docs.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Sdk access to filemanager documents directory
 
 
Q