Search code examples
iphoneiosjailbreak

Where are the iOS frameworks binaries located in the filesystem?


I'm kind of confused about frameworks on iOS. I think they are basically a directory containing a dynamic library, headers and resources.

But in my device the frameworks directories in System/Library/Frameworks don't contain the dynamic library. How is this possible? Shouldn't it be present to be loaded in memory when the application requiring it is launched?


Solution

  • The binaries no longer exist on-device (and have not since iOS 3.1): Apple has merged them all into one large mmap()'ed cache file, to make app launch a bit more efficient. As the pages usually never change, the kernel can effectively share them between every running image. You can still use dlopen() on files held within the cache, as dyld short-circuits file lookup when the given library exists in the cache.

    The cache file is in /System/Library/Caches/com.apple.dyld, and is named after the architecture (armv6 or armv7). The libraries within can be extracted using dsc_extractor or KennyTM's dyld_decache, available in this repository, but once extracted they can't actually be loaded into memory properly (as they all effectively get their symbol tables merged in the cache.)

    There's a bit of a better (though older and less informed, more in-depth) write-up here: http://blog.howett.net/2009/09/cache-or-check/.