Sandbox: Think like Apple


Apple allows read access to nearly the entire iPhone file system. This is a mixed blessing. Your Application can read that data -- but it shouldn't. Apple has been rejecting apps that stray outside their sandbox.

From the various rejection letters that I've seen, Apple cites non-specific "violations". These violations have nothing to do with the actual reason that application will not get into AppStore. It helps to see a cross section of these letters because you wouldn't necessarily pick up the point directly from the email.

So bottom line: If your app accesses the various databases and media folders directly (address book, photos, notes, etc) rather than through the approved classes, there's a good chance Apple will block it.

The iPhone sandbox is a lot looser than Apple's comfort levels. You can do things like reading those files that Apple doesn't want to you to. But just because you have technical access and have reviewed the terms of your agreement doesn't mean that your application is going to sail into App Store.

With each firmware iteration, the restrictions are getting tighter. That open-source copy/paste scheme that was introduced a few weeks back is dead now with version 2.1. Applications are now invisible to each other. There are no public blackboards or shared spaces so no shared data standards.

You can examine the current state of the sandbox for the current release by looking at /usr/share/sandbox. There you'll find the standard sandbox template, SandboxTemplate.sb. It consists of a series of allow and deny statements that specify the way your applications must interact with the system.

The point of today's post is to raise awareness. "Can" is not the same as "should". Apple calls the shots. The iPhone is a closed platform. So if you're developing software, try to think from Apple's point of view. Because if your Application, albeit helpful and innocuous and agreement compliant, doesn't match that ideal, it's not going to be approved.

AddThis Social Bookmark Button
Comments (11)

11 Comments

Steve Smith said:

Well, since it is SO EASY to jailbreak an iPhone with QuickPwn we can with just one click and a two minutes wait have the best of both worlds! That is, we get the great AppStore apps but more importantly the even greater, though non-approved, killer apps like an amazing Video Recorder called Cycorder, the possibility to send and receive MMSs using SwirlyMMS and great theming abilities via Winterboard.

Paul Johnson said:

Yes, and then you'll have some awesome crashes, freezes, and reboots, just like the other "smartphones." Later the malware will come along to make your life more interesting.

PJ Cabrera said:

Paul Johnson, don't write about things of which you don't know the facts as if you opinion was authoritative.

Myself and many other iPhone owners around the world have jailbroken iPhones and have none of the awesome crashes, freezes or reboots of which you speak.

Paul Johnson said:

PJ Cabrera, thanks for your authoritative refutation. A Google search with the names of the programs mentioned in the first comment and "freeze," "reboot" and/or "crash" is enough authority for me. Also, "jailbreak" "iPhone" and the other terms above will reveal lots of relevant experience. I have no financial interest in selling jailbreak programs; do you?

Michael Teuber said:

It doesn't take an 'authority' to understand that if you jailbreak your iPhone, you are on you own when it comes to the problems and potential security risks posed by any jailbreak app you install.

Argument from authority is fallacious argument anyway... :P

nomuus said:

Apple really seems to have a cautious stance when it comes accessing different components on the iPhone and it's understandable being that some legitimate developer could potentially jack up things on the device. I applaud your efforts Apple for taking the time to filter out the "bad stuff" and limit what is done on the device; security through obscurity (;]), perhaps, but it seems to be keeping things relatively secure. This is topic is obviously arguable though I will refrain from fueling the fire. This aside, however, I'd like to comment on jail broken phones. It is remarkably easy to jailbreak your phone, but I will pose a few rhetorical questions to everyone: 1) How can one be so sure the code that jailbreaks the phone is legitimate? 2) If no one has seen the jail break code, what exactly is it modifying -or- installing for that matter? 3) Is it really /that/ secure? No flames to the dev-teams and individuals who've made it possible, rather, cheers to you all; just expressing my concerns.

yeah said:

yeah, apple is real secure when it comes to iphone, oh wait it got hacked and jailbroken by > 1 million people over the world.

better luck next time apple

Mike55 said:

I absolutely agree with the author of this article. Keep in mind that it was written 3 years ago, however there are still some companies which can' understand that optimizing website for iPhone users is crucial. They think that very few users are browsing using iPhone but it is not true for sure. Nowadays Apple products are highly popular so making your web page iPad and iPhone friendly is a crucial part if you want to make a successful website. Hope my advices help. Thanks for the great article by the way and keep publishing them in the nearest future too. Mike from mobile development

smith said:

I think when you develop a mobile application using development cert this application generates a unique device token.This is not going to work on push
network.These puch SSL of apples will reject you token this is something you have to
see when you develop a app.I think this article will really help the iphone application developers.Apple products are always a trademark for quality whether
its sound quality,features,application.

Jane said:

That's why I prefer to work with Android platfrom. it is an open platfrorm and there appear less questions with android development.

David said:

I will still say Apple iPhone is much more secure. Yes it gets jail broken sometimes, but u need physical access to it to do that. While with android anyone can create an app which can steal the data from your mobile's SD card. Regards, David from iPhone Development and Android Development.