Using the Apple SDK with low-level APIs ("tool chain" APIs)

Credits: Saurik (Aspen modifications to compiler, general build flag hackery), NerveGas (some header file maintenance)

Apple's low-level APIs, used in the open tool chain, contain some objects and methods that have been intentionally left out of the Apple SDK, to help control what developers can and can't do. These include limiting what frameworks they can use as well as certain objects, such as UIPreferencesTable, in order to prevent your application from having as much functionality as preloaded applications. You can take advantage of these hidden APIs and still use the Apple SDK with some changes to your build flags. Please note that this is not “authorized” by Apple, and may disqualify your application for distribution in the AppStore. It is ultimately up to them which APIs they say you can “officially” use.

For those who would like to use XCode and the Apple SDK without the restrictions imposed by Apple, the lower-level APIs can be enabled in XCode with a few simple changes. Please note that this may violate your Apple SDK agreement, depending on whether you have what Apple refers to as an “other agreement” in place.


The instructions below are for Beta 1 of the SDK. To use them with Beta 2, replace all occurrences of “Aspen1.2” with “iPhoneOS2.0”

From a terminal window on your desktop, run the following commands to download and install the private API layer (also known as the tool chain layer):

    $ sudo mkdir -p /Developer/SDKs/iPhoneOS.sdk/Versions/Aspen1.2.sdk/
    $ svn co
    $ cd include-1.2-sdk
    $ ./configure --prefix=/Developer/SDKs/iPhoneOS.sdk/Versions/Aspen1.2.sdk/
    $ sudo sh

Now, in your XCode project, go to Project → Edit Project Settings, then click on the Build tab. Find the option titled “Other C Flags” underneath the “GCC 4.0 - Language” heading. Add the following values, all on one line (with no carriage returns). Remove the colons from below as well:

  : -I/Developer/SDKs/iPhoneOS.sdk/Versions/Aspen1.2.sdk/include
  : -I/Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk/usr/include
  : -I/Developer/Platforms/Aspen.platform/Developer/usr/lib/gcc/arm-apple-darwin9/4.0.1/include
  : -F/System/Library/Frameworks -F/Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk/System/Library/Frameworks
  : -F/Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk/System/Library/PrivateFrameworks

Now save these settings.

Congratulations! You can now build your application with the private, low-level APIs and frameworks available on the iPhone, and install your application directly onto a 1.2/2.0 device from XCode. See this book for some great examples on how to use many both “official” and private iPhone APIs and frameworks.

To use a private framework in XCode, switch your build to “Device - Aspen 1.2”. This will automatically change your architecture “armv6”. Now, right-click on the “Frameworks” folder and select “Add → Existing Frameworks”. This will drop you into a frameworks folder. You can choose the framework you'd like to add. For example, if you want to add the “CoreSurface” framework, navigate to /Developer/Aspen.platform/Developer/SDKs/Aspen1.2.sdk/System/Library/PrivateFrameworks/ (if necessary) and select the CoreSurface framework.

Now you can #import <CoreSurface/CoreSurface.h> into your project and build against the CoreSurface framework! Other hidden frameworks can be added using the same basic instructions.

Consult “iPhone Open Application Development” for full blown examples of using both the public and private APIs and frameworks:

howto/using_sdk_with_toolchain_headers.txt · Last modified: 2008/03/27 20:47 (external edit)
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki