iOS のフレームワークについてちょっと混乱しています。基本的には、動的ライブラリ、ヘッダー、およびリソースを含むディレクトリだと思います。
しかし、私のデバイスでは、System/Library/Frameworks のフレームワーク ディレクトリに動的ライブラリが含まれていません。これはどのように可能ですか?それを必要とするアプリケーションが起動されたときにメモリにロードされるように存在するべきではありませんか?
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/.
私もこれに気づきました。変。「彼らがどこにいるのか」を説明することはできませんが、たとえば次のように観察しました。
(プライベート) フレームワーク ディレクトリを一覧表示すると、次のようになります。
iPhone4:/System/Library/PrivateFrameworks/BluetoothManager.framework root# ls -alt
total 8
lrwxr-xr-x 1 root wheel 28 Nov 4 2011 CodeResources -> _CodeSignature/CodeResources
drwxr-xr-x 3 root wheel 170 Nov 2 2011 ./
drwxr-xr-x 2 root wheel 102 Nov 2 2011 _CodeSignature/
-rw-r--r-- 1 root wheel 740 Nov 2 2011 Info.plist
drwxr-xr-x 170 root wheel 5814 Dec 31 2007 ../
iPhone4:/System/Library/PrivateFrameworks/BluetoothManager.framework root# ls -alt _CodeSignature/
total 0
drwxr-xr-x 3 root wheel 170 Nov 2 2011 ../
drwxr-xr-x 2 root wheel 102 Nov 2 2011 ./
-rw-r--r-- 1 root wheel 1222 Nov 2 2011 CodeResources
BluetoothManager.framework/BluetoothManager
dylib ファイル が表示されません。ただし、このコードは実際には、そのファイルが存在するかのように、そのフレームワークを動的に開くために機能します。
handle = dlopen("/System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager", RTLD_LAZY);
find
ルート ファイルシステム (「/」) の場所からコマンドを使用しても、デバイス上にBluetoothManagerという名前のファイルは見つかりません。
おそらくあなたが探している答えではないことはわかっていますが、知りたい理由によっては、役立つかもしれません。