LoginSignup
2
2

More than 5 years have passed since last update.

kCFCoreFoundationVersionNumber

Posted at

この記事は iOS Jailbreaking Advent Calendar 2015 の3日目の記事です。
2日目はSwift for tweak.でした。

kCFCoreFoundationVersionNumberはCoreFoundation.frameworkのバージョンを取得出来る定数でCFBase.hで定義されています。

CFBase.h
CF_EXPORT double kCFCoreFoundationVersionNumber;

バージョンによって分岐する場合、Jailbreak界ではこれでバージョン切り分けをするかrespondsToSelector:で切り分けるかするのがデファクトです。というのもこのバージョンによってFilterする機能がCydiaSubstrateに搭載されていた為でしょうか。これを真似て後にPreferenceLoaderでもCoreFoundationVersionキーでのFilterが導入されています。

あまり普通のアプリケーションやライブラリで使われているのを見ませんがCFBase.hには節目のバージョンがメジャーバージョンアップの時に追加されています。

CFBase.h
#if TARGET_OS_IPHONE
#define kCFCoreFoundationVersionNumber_iPhoneOS_2_0 478.23
#define kCFCoreFoundationVersionNumber_iPhoneOS_2_1 478.26
#define kCFCoreFoundationVersionNumber_iPhoneOS_2_2 478.29
#define kCFCoreFoundationVersionNumber_iPhoneOS_3_0 478.47
#define kCFCoreFoundationVersionNumber_iPhoneOS_3_1 478.52
#define kCFCoreFoundationVersionNumber_iPhoneOS_3_2 478.61
#define kCFCoreFoundationVersionNumber_iOS_4_0 550.32
#define kCFCoreFoundationVersionNumber_iOS_4_1 550.38
#define kCFCoreFoundationVersionNumber_iOS_4_2 550.52
#define kCFCoreFoundationVersionNumber_iOS_4_3 550.52
#define kCFCoreFoundationVersionNumber_iOS_5_0 675.00
#define kCFCoreFoundationVersionNumber_iOS_5_1 690.10
#define kCFCoreFoundationVersionNumber_iOS_6_0 793.00
#define kCFCoreFoundationVersionNumber_iOS_6_1 793.00
#define kCFCoreFoundationVersionNumber_iOS_7_0 847.20
#define kCFCoreFoundationVersionNumber_iOS_7_1 847.24
#define kCFCoreFoundationVersionNumber_iOS_8_0 1140.1
#define kCFCoreFoundationVersionNumber_iOS_8_1 1141.14
#define kCFCoreFoundationVersionNumber_iOS_8_2 1142.16
#endif

・・・が、見てわかる通り8.3や8.4がなかったりと完全網羅されていません(ちなみにちゃんとバージョンあがってます)。このあたりが普通のアプリケーションで使われない原因でしょうか。

SDKのtbdファイルに記述があるのでそちらから確認出来ます。これはiOS 9.1で1241.11です。

$ pwd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreFoundation.framework
$ head CoreFoundation.tbd 
---
archs:           [ armv7, armv7s, arm64 ]
platform:        ios
install-name:    /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
current-version: 1241.11
compatibility-version: 150.0
objc-constraint: retain_release
exports:         
  - archs:           [ arm64 ]
    symbols:         [ __CFBigNumGetInt128, __CFBigNumGetUInt128, __CFBigNumInitWithInt128, 

後はCydiaSubstrateがローディングを開始した際にも表示されます。こちらは実機でのkCFCoreFoundationVersionNumberでの取得結果なので、自前のkCFCoreFoundationVersionNumberリストの作成時には一応こっちで確認するようにしていますが、いまのところSDKと相違があった事はないです。

Dec  3 23:10:58 i6s com.apple.WebKit.WebContent[8080]: MS:Notice: Injecting: com.apple.WebKit.WebContent [com.apple.WebKit.WebContent] (1240.10)
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2