Sandboxing iOS Simulator

An iOS app running in simulator has complete access to the Mac's file system:

// Files in protected directory like Desktop, Documents, Calendar, etc will need additional permissions.
let filesInSystem = FileManager.default.enumerator(at: .currentDirectory(), includingPropertiesForKeys: nil)?.allObjects

This isn't the case when running in device as the app is sandboxed. Is the same possible when running in simulator? More specifically, is there a way to restrict access to the Mac's file system when running an app in the Simulator? This is particularly useful when trying out binaries/frameworks that are not open sourced.

Is the same possible when running in simulator?

There is not.

This is particularly useful when trying out binaries/frameworks that are not open sourced.

That’s an interesting wrinkle. Most folks who ask about this are happy that their simulated app can access the macOS file system, using that to access configuration files and so on. However, I tend to fall into your camp, not just because of the security benefits but also because it’d make the simulator more faithful.

Regardless, this isn’t how it works today and, if you’d like to see that change, I encourage you to file an enhancement request describing your rationale.

Please post your bug number, just for the record.

Share and Enjoy

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

Sandboxing iOS Simulator
 
 
Q