iPhone OS X Architecture: Cocoa Frameworks and Mobile Mac Apps
July 16th, 2007
Daniel Eran Dilger
Continuing on the series looking at the architecture of the iPhone, here’s a look at the Mac system frameworks and application environment on the iPhone.
[Leopard, Vista and the iPhone OS X Architecture]
[iPhone OS X Architecture: the Mach Kernel and RAM]
[iPhone OS X Architecture: Disk, Shell, and Password Security]
[iPhone OS X Architecture: the BSD Unix Userland]
The iPhone’s OS Domains.
Outside of the invisible Unix directories, Mac OS X maintains its own three primary domains, which were largely inherited from NeXTSTEP. These mirrors aspects of the domains found in Unix, but strives to make things clearer and more distinct. They are the:
• System domain contains software Apple installs. Includes everything under /System.
• Local domain contains machine specific software. Includes everything inside /Library and /Applications
• User domain contains user specific files. Includes individual user accounts inside /Users.
This system of domains enables Mac OS X to protect and isolate the System–which is intended to not change unless Apple updates it–from the changes made by a local machine administrator and the changes made by individual users.
Mac OS X vs OS X.
The iPhone’s OS X installation is remarkably similar to the standard desktop Mac environment and that of its slower cousin, the Apple TV. There are a number of key differences however.
User Domain: As noted earlier in the BSD Unix userland article, the iPhone doesn’t need to accommodate different users, so there is no /Users folder. Everything is stuffed in the /usr directory.
Apple may never need to include multiple user accounts on the iPhone, but as reader ZU pointed out, it might make some sense for Apple to later add a mechanism similar to the Mac’s parental controls, where the iPhone could be put into one of several security modes to grant limited access to a holder.
This could accommodate the iPhone–or a future version of the iPod–being used in a limited kiosk-only mode for multimedia walking tours, entering a phone-only mode when lending it out, or in actual use as a parental control for limiting kids’ use of certain applications, visiting certain hosts, or limiting hours of use.
Local Domain: Like Mac OS X, the iPhone’s applications are stored in /Applications. There’s not much in /Library beyond ringtones and wallpapers, as there’s no provision for third party additions or installations by a machine administrator. That leaves the local domain fairly slim, with bundles of the iPhone’s Cocoa apps:
• FieldTest.app (invoked by dialing *3001#12345#* this displays technical information about the network)
Application Bundles: Mac OS X applications appear to be files in the Finder, but are usually bundles. In the world of Mac OS X, a bundle is a specially marked folder that is designed to behave like a file, simplifying interaction for the user and making application installation an effortless drag and drop experience.
An application bundle on Mac OS X houses a Contents folder holding the subfolders:
• Mac OS
This outline makes it easy for developers to organize the files their application needs without requiring the user to manage directories of stray files within various directories, and without packing all sorts of support files directly inside the actual application’s binary executable file.
Bundles also helped in the transition from Classic Mac OS 9 to Mac OS X by accounting for differences in the Classic Environment on X and the native environment on 9.
Of course, the iPhone has no need to support a transition environment from OS 9, so its bundles are simpler. They only contain an application, its localizations (currently English only), supporting graphics and other files.
The most familiar iPhone application isn’t listed above: SpringBoard. It acts like the iPhone’s Finder, Dock and Desktop, similar to the Apple TV’s BackRow application. Like BackRow and the Finder, it resides in the…
System Domain: Like Mac OS X, the iPhone has a System directory containing its Cocoa frameworks and system utilities. The Mac OS X Finder doesn’t live in /Applications, it’s hidden away in /System/Library/CoreServices, along with the Dock, Help, System Update, Spotlight and a variety of faceless helper apps that act as part of the Finder’s desktop environment.
Apple TV is laid out similarly, replacing the Finder with BackRow. Unsurprisingly, iPhone follows the same approach with its home application. SpringBoard manages the familiar starting point of app icons, along with the top info bar of the clock, network, and battery indicators and the bottom dock bar with its four main apps.
Next to SpringBoard in CoreServices is the mDNSResponder bundle, the less friendly name of Bonjour. The iPhone’s Bonjour is currently silent, but the fact that this is here–despite being just a shell at present–hints at significant new features Apple will deliver in the future, which I’ll cover in a future article.
Outside of CoreServices in the System domain are folders of sound effects, cache files, hardware drivers, file system support (it’s HFS), Fonts, Frameworks, Internet Plugins (currently only QuickTime), LaunchDaemons, Lockdown, the meat of Settings.app, and SystemConfiguration.
• Celestial, related to sound ceilings and vibration settings.
• CoreSurface, manages multitouch input.
• TelephonyUI, manages call dialing and answer features and contains the dial tones.
• URLify, apparently helps recognize phone numbers in web pages and makes them dial-able links.
• LayerKit, the former name for Leopard’s Core Animation.
There are at least three libraries related to the iPhone’s PowerVR MBX 3D graphics processor, which was developed by Imagination Technologies Group as a coprocessor for the ARM.
• OpenGLES (OpenGL ES is a graphics library for mobile embedded systems. It is also used by Symbian.)
Samsung licensed the PowerVR graphics accelerator back in 2004 and appears to have integrated it together with an ARM core on the “System on a Chip” processor used in the iPhone.
And then there are a few more mysterious frameworks:
• UIKit.framework (blogger Fraser Speirs speculates this may be “the iPhone’s version of AppKit”)
PreferenceBundles function within the Settings application, similar to System Preferences panes in Mac OS X, although not all of the settings modules are presented in the iPhone’s UI. Installed are:
• AirPortSettings for WiFi networking
• CarrierSettings (interesting)
• EDGESettings (not configurable in Settings)
• various mobile application settings
SystemConfiguration includes both Settings and some internally configured items:
• Aeropuerto likely involves airplane mode, apparently in Spanish to distinguish it from AirPort WiFi settings.
• Various network and power management settings
• Profiler, which lists three items apparently used by the service provider:
Using the Apps on the iPhone.
Sitting on top of the Mach, BSD, and Mac layers on the iPhone is its slick user interface. I’ll delve into how each wing of its applications stack up, what’s missing and what future potential lies suggested in hints.
Like reading RoughlyDrafted? Share articles with your friends, link from your blog, and subscribe to my podcast! Submit to Reddit or Slashdot, or consider making a small donation supporting this site. Thanks!