GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

Access outside of Sandbox

Forums > Swift

Hi,

While developing my app I've created a File Dialog to allow me to load and save files (it works, hurrah!) and while developing it, it has always stayed within the sandbox, ie, never let me go above the current app's 'Document' folder.

However, I've moved the code over to another app, the main project I developed it for, and when clicking the 'Parent Folder' button, it allows me to travel up through the folder structure until I reach '..' with the folders 'Library', 'System', 'Users' and 'Applications' beneath it. I am able to save my files in any of the folders throughout the structure (though any other files there aren't presented).

Firstly, should I be able to do that? Secondly, if so, how the hell have I done it? And thirdly, why would it be exhibiting such behaviour in the this app when it didn't in the original code? I've got a feeling it's against the guidelines so I'd really like to know how to resolve it.

Any thoughts?

Thanks in advance,

Jes

3      

Assuming you are talking about a Mac app, I can think of two reasons where someone would be able to access files outside the Sandbox in the main project.

  • The project turned off the Sandbox.
  • The Sandbox settings give the app permission to access user selected files.

It's OK for a document-based Mac app to let people save documents where they want. I would be annoyed if a Mac app forced me to save my documents in the app's Documents folder.

4      

Hi,

I've tried again today and haven't been able to replicate. It was, however, running in the simulator for an iPad..! There is a suspicion that maybe I'd run it in the mac simulator beforehand but I can't be sure; I'll keep checking.

Thanks for the response :)

3      

I am designed to operate within a safe and restricted environment, known as the "sandbox." This means I can't browse the internet or access any information or content that has been generated or updated after my last update in September 2021.

My primary function is to assist and provide information based on the data available up to that point. If you have any questions or need help with anything within that scope, feel free to ask, and I'll do my best to assist you!

3      

Hacking with Swift is sponsored by try! Swift Tokyo.

SPONSORED Ready to dive into the world of Swift? try! Swift Tokyo is the premier iOS developer conference will be happened in April 9th-11th, where you can learn from industry experts, connect with fellow developers, and explore the latest in Swift and iOS development. Don’t miss out on this opportunity to level up your skills and be part of the Swift community!

Get your ticket here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.