RSS

iPhone SDK Application Sandboxing

March 19th, 2008 Posted in iPhone

iPhone Icon

Applications developed for the iPhone using the new SDK will run in a sandboxed environment. This is similar to browser based applications such as Java and Flash. The application is given limited access to resources available on the system.

In the case of the iPhone, applications will only be able to access files stored in the application’s own private directory. An application will have no access to system files or the files belonging to other applications. Applications will only be able to change their own private configuration information, although they will have read only access to system configuration information.

Application directory layout:
iPhone Application Directory Diagram

Application.app is a file that packages the application executable program along with any resources such as sound files and images files.

Documents/ is a directory where applications will save and load documents that they create.

Library/Preferences/ is where application specific configuration information is stored. Applications can access this data using the CFPreferences API.

tmp/ is a directory used to store temporary files. Applications are responsible for cleaning up the files in this directory. All files and directories in the application directory can be backed up except this directory.

The ApplicationRoot directory can be located using the NSHomeDirectory API call and the tmp/ directory can be located using the NSTemporaryDirectory API call.

Applications will have no direct access to the hardware. Using hardware devices such as WiFi connections and accelerometers can only be accomplished by going through APIs provided by the SDK frameworks.

To some this might seem like a very restrictive environment to develop in but I’m not of that opinion. I believe that ensuring that custom applications can do as little as possible to harm an iPhone is important. Apple is providing for many safeguards to make sure that using third party applications is safe.

Some of the safeguards include:

  • Apple Store Distribution - You can only get iPhone applications from one place. This makes it much harder to distribute bad and harmful applications.
  • Application signing - Since applications have to be digitally signed by the developer it is easier to trace harmful applications back to the source.
  • Sandboxing - This limits the damage a harmful application can do to a user’s iPhone.
  • One application at a time - This makes it hard for a virus type application to run in the background on your phone and do harmful things without you knowing it.

These are good things to an end user who wants to purchase and download third party applications. They can do it without fear of killing their valuable piece of hardware, corrupting their data or having a virus running on their phone.

[del.icio.us] [Digg] [Reddit] [Technorati]

RSS feed | Trackback URI

1 Comment »

Comment by nico Subscribed to comments via email
2008-08-08 15:37:02

Hmm, I noticed that when I wrote a property list file (I don’t know where I have the code as I did this last week) and didn’t specify the absolute path (just a filename), it wrote to the root (/) directory while running via the Simulator. This concerned me as my understanding is that the write capabilities are limited to the ’sandbox’. I have to assume that this is only going to happen while using the simulator and that the device DOES restrict to sandbox but I don’t have a real iPhone LOL. Can someone confirm this? Thanks.

 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.