Snooping around the frameworks

| | Comments (2) | TrackBacks (0)
Uncharted Frameworks
If you go to your iPhone file system, and look in the directory /System/Library/Frameworks, you'll see a  list of the different frameworks available for iPhone programming.  For ones that are mainly in ObjC (e.g. UIKit, etc), you can find a listing of all the methods on sites like Erica Sadun's. 

For Frameworks that are mainly in C (or C++), assuming there is no available listing somewhere on the Internet, you will have to snoop to discover the method names. 

Here are a few tools that you can use on the binaries within these folders to see what they contain.  These are run from your personal computer, and should be available after you install the toolchain. 
  • arm-apple-darwin-nm : this will print out a list of symbols
  • arm-apple-darwin-otool : this will (among other things) print out a disassembly
  • strings : this will print out the strings in the binary
Example of use:
(I'm on Windows, so I use cygwin for the prompt.)
$ cd /usr/local/share/iphone-filesystem/System/Library/Frameworks/AudioToolbox.framework
$ arm-apple-darwin-nm AudioToolbox > AudioToolboxSymbols.txt
This will put the symbols of the AudioToolbox framework into a new file called AudioToolboxSymbols.txt.

Mangled names
When you look at the raw list of symbols, some of the method names may look garbled.  That's because they are "mangled"...this ensures that every method has a unique name.
Mangled C names will often be preceeded with an underscore. 
Mangled C++ names will look something like this:

The unmangled version would be:
MeCCA_AudioRoutingPolicy::setRoutingPolicy(char const*)

If you want to unmangle the names in the symbols text file you just created, you can use a command called c++filt
Example of usage:
$ c++filt < MySymbolsFile.txt > MyUnmangledSymbolsFile.txt

0 TrackBacks

Listed below are links to blogs that reference this entry: Snooping around the frameworks.

TrackBack URL for this entry:


Mir said:

Can you please tell me how i can write the file line by line using NSString methods,i am unable to write but i am unable to write line by line and my file gets overriden.I am trying to write in the file from textfields of UIAlertSheet.
And i currently working from windows.Awaiting for your precious reply,please please

Mir Taqi

JLA said:

So you want to append (add on to the end of) a text file? If the text file isn't too big, you can do this:
1. first read the previous contents into a string with NSString's this StringA.
2. come up with everything you want to add to the file, line by line, by writing to another can use an NSMutableString and call appendString on it, adding new lines. Dont forget to append "@\n" between every line...this is how it knows it's a new line. Call this new data StringB.
3. Combine the two, creating a StringC. e.g. StringC = [StringA stringByAppendingString: StringB];
4. Write to file using NSString's writeToFile.

If you want a more elegant way to do this, you can use NSFileHandle...I've never used it, but you can do a Google of "Cocoa appending text". Also, Apple has good documentation for the NS classes...these are pretty much the same as they are in Cocoa.

Leave a comment

About this Entry

This page contains a single entry by JLA published on February 8, 2008 1:19 AM.

Audio dependencies was the previous entry in this blog.

Low level audio on the iPhone : a brief introduction is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.



Powered by Movable Type 4.1-en-release-26-r1120-20071224