如何获取库中导入方法的列表?

时间:2013-07-30 03:18:50

标签: objective-c macos

我目前正在使用nm -ufm来获取库文件中的导入列表。但是,对于objective-c符号,我似乎只是获取导入的类定义。例如,libGoogleAdMobAds.a中导入的符号的一部分是:

libGoogleAdMobAds.a(GADIdentifierUtilities.o) (for architecture i386):
         (undefined) weak external _CC_MD5
         (undefined) external _CFBundleGetInfoDictionary
         (undefined) external _CFBundleGetMainBundle
         (undefined) external _CFDictionaryGetValue
         (undefined) external _NSSearchPathForDirectoriesInDomains
         (undefined) external _OBJC_CLASS_$_GADNumberUtilities
         (undefined) external _OBJC_CLASS_$_NSArray
         (undefined) external _OBJC_CLASS_$_NSBundle
         (undefined) external _OBJC_CLASS_$_NSData
         (undefined) external _OBJC_CLASS_$_NSDictionary
         (undefined) external _OBJC_CLASS_$_NSMutableDictionary
         (undefined) external _OBJC_CLASS_$_NSMutableString
         (undefined) external _OBJC_CLASS_$_NSNumber
         (undefined) external _OBJC_CLASS_$_NSObject
         (undefined) external _OBJC_CLASS_$_NSPropertyListSerialization
         (undefined) external _OBJC_CLASS_$_NSString
         (undefined) external _OBJC_CLASS_$_NSURL
         (undefined) external _OBJC_CLASS_$_NSUserDefaults
         (undefined) external _OBJC_CLASS_$_UIApplication
         (undefined) external _OBJC_CLASS_$_UIDevice
         (undefined) external _OBJC_CLASS_$_UIScreen
         (undefined) external _OBJC_EHTYPE_$_NSException
         (undefined) external _OBJC_METACLASS_$_NSObject
         (undefined) external __Unwind_Resume_or_Rethrow
         (undefined) external ___CFConstantStringClassReference
         (undefined) external ___objc_personality_v0
         (undefined) external __objc_empty_cache
         (undefined) external __objc_empty_vtable
         (undefined) external _kCFBundleVersionKey
         (undefined) external _kGADParameterApplicationName
         (undefined) external _kGADParameterAudioOutput
         (undefined) external _kGADParameterBaseSdkVersion
         (undefined) external _kGADParameterCapabilitiesBookstore
         (undefined) external _kGADParameterDeviceID
         (undefined) external _kGADParameterDeviceModel
         (undefined) external _kGADParameterDeviceSubmodel
         (undefined) external _kGADParameterIPadCompatibilityMode
         (undefined) external _kGADParameterITunesMetadata
         (undefined) external _kGADParameterJailbroken
         (undefined) external _kGADParameterLocale
         (undefined) external _kGADParameterScreenDensity
         (undefined) external _kGADParameterScreenHeight
         (undefined) external _kGADParameterScreenOrientation
         (undefined) external _kGADParameterScreenWidth
         (undefined) external _objc_begin_catch
         (undefined) external _objc_end_catch
         (undefined) external _objc_enumerationMutation
         (undefined) external _objc_msgSend
         (undefined) external _objc_msgSendSuper2
         (undefined) external _objc_msgSend_fpret
         (undefined) external _objc_msgSend_stret
         (undefined) external _strlen
         (undefined) external _uname

其中列出了一堆Objective-c类,但我想确切地知道调用哪些方法。

我对Objective-c方法调用的实现细节知之甚少(原谅我,我的意思是“消息传递”),但是因为我也看到导入的_objc_msgSend,这是否意味着调用使用某种反射在运行时通过名称解析?

无论如何,是否可以获得库使用的实际方法列表?

注意:应该可以,因为Apple可以。我正在调查我对使用uniqueIdentifier UIDevice方法的iOS应用程序的拒绝,但按照建议的here做一个简单的grep太过模糊了,字符串可以是任何东西,包括文件中的字符串资源,我想证实我使用grep获得的信息和更实质的报告,例如来自nm的报告。

0 个答案:

没有答案