How Do I Use Private Frameworks?

Discussion in 'iOS Development' started by artful_dodger74, Mar 23, 2010.

  1. artful_dodger74

    artful_dodger74 New Member

    Joined:
    Mar 23, 2010
    Messages:
    3
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    Ok so i am completely new to developing with private api's or anything remotely got to do with the iphone toolchain. I've been learning objective c for the past 9 months and have been mostly concentrating on "official" sdk means.

    For the past 2 days I have been reading up on anything related to messing around with private frameworks but i cant seem to find a complete guide to get up and running. To be honest i think i've read myself around in circles looking at the toolchain and class dumping header files etc. Can anybody please point me in the right direction?

    I'm a bit confused on where i should start. i.e. importing private frameworks and getting them to work in your xcode project.

    I'm running snow leopard 10.6.2 and using a jailbroken iphone 3gs firmware 3.1.2 if that matters much.

    Any help or a point in the right direction to a guide or tutorial would be much appreciated.
  2. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    to class-dump a binary:

    Code:
    class-dump /path/to/binary -o /output/directory
    You can install class-dump on your Mac, or your iPhone, from Cydia.

    You can easily "add" a private framework in XCode: right click in the left panel, select Add > Existing Framework > Add Other, and browse to <sdk_root>/System/Library/PrivateFrameworks/...>

    A listing of all frameworks and their putative purpose/uses can be found here - http://theiphonewiki.com/wiki/index.php?title=Frameworks
  3. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    Aren't all private frameworks/libraries already in Xcode's list (when you open the Get Info panel on your target)?

    EDIT: You'll still need to get the header files for most private frameworks.
  4. artful_dodger74

    artful_dodger74 New Member

    Joined:
    Mar 23, 2010
    Messages:
    3
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    Thank for the reply.

    Yeah i class dumped the header files of springboard.app from the simulator. I have all the header files in a folder on my desktop but where do I go from here? I read somewhere i need to move them to the include directory of my compiler? Is this correct? Or do i add the relevant header file to my project and reference them with the import statement? I'm completely new to this.

    I've also added a private framework to my project in xcode and used the include directive in my .h file but i'm getting no such file or directory error. Do i need to edit any of the project settings?

    It might be just something simple i am leaving out but i just cant figure it out. Any help again would be appreciated.
  5. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    First of all, if you want to use any of SpringBoard.app's classes/methods, you'll need to make a dynamic library and hook it into SpringBoard with MobileSubstrate, etc. That's a completely different story.

    To import a private framework into a standard executable/app, you need to
    a) Get header files. For Objective-C/Cocoa (touch) frameworks, the easiest way is to use class-dump and fix them up. To add the headers, either copy them into the Framework's Headers directory (then you can use #import <MyPrivateFramework/Something.h>, but any SDK updates will probably erase this) or just drag the .h files into your project and import them like your other project headers
    b) Link it. Just use Axis' or my previous instructions.
  6. artful_dodger74

    artful_dodger74 New Member

    Joined:
    Mar 23, 2010
    Messages:
    3
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    Finally i get it! Thanks a lot for your help, much appreciated. I'll have a go at this tonight and see how i get on.
  7. general2000vn

    general2000vn New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0

    Hi, I don't get the bit of adding existing private framework form your post. That way will add existing "binary framework" but not "header" , right?
    Because Private framework does not have headers, we class-dumped header files into different path, correct? Or we have to move class-dumped headers to any specific path?

    Please help me with this. Thank you very much.

    Alex
  8. misdellep

    misdellep Guest

    How to create dylib for springboard and how to use the mobile substrate? Cannot find info, need to create an app to programatically toggle wifi module. Is creating springboard dylib the solution for my app? Thanks in advance!

Share This Page