Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to inspect .a library?

Tags:

xcode

ios

I was given a .a library with very poor documentation. Is there a way to inspect the public types, methods, and properties?

like image 539
Jonas Stawski Avatar asked Sep 22 '12 20:09

Jonas Stawski


1 Answers

There are several options - the one I prefer is otool;

From its man page for the possible options:

-o Display the contents of the __OBJC segment used by the Objective-C run-time system.

Example:

otool -o libRaptureXML_universal.a

[...]
    contents of (__DATA,__objc_classlist) section
    00006fe0 0x65d4
               isa 0x65e8
        superclass 0x0
             cache 0x0
            vtable 0x0
              data 0x6fb8 (struct class_ro_t *)
                        flags 0x0
                instanceStart 4
                 instanceSize 12
                   ivarLayout 0x0
                         name 0x6b84 RXMLElement
                  baseMethods 0x6e08 (struct method_list_t *)
               entsize 12
                 count 27
                  name 0x66bb initFromXMLString:encoding:
                 types 0x6b90 @16@0:4@8I12
                   imp 0x1
                  name 0x66e3 initFromXMLFile:
                 types 0x6b9d @12@0:4@8
                   imp 0xd5
                  name 0x66f4 initFromXMLFile:fileExtension:
                 types 0x6ba7 @16@0:4@8@12
                   imp 0x209
                  name 0x6713 initFromURL:
                 types 0x6b9d @12@0:4@8
                   imp 0x335
                  name 0x6720 initFromXMLData:
                 types 0x6b9d @12@0:4@8
                   imp 0x411
                  name 0x6731 initFromXMLNode:
    [...]
like image 165
Till Avatar answered Oct 18 '22 13:10

Till