Dumping frameworks for iPhone 3.0 not working?

2019-09-19 19:30发布

问题:

Hey I need some extra capabilities for my program and I would like to use some Undocumented APIs for my iPhone program. I downloaded: DumpFrameworks as Dumpframeworks.pl and class-dump from : http://ericasadun.com/HeaderDumpKit/

I put DumpFrameworks.pl in Downloads and class-dump file in /usr/local/bin

in the terminal I run:

$perl DumpFrameworks.pl

and some warnings and errors appeared:

Framework: Accelerate
2009-09-30 08:39:58.776 class-dump[466:903] Warning: This file does not contain any Objective-C runtime information.
Framework: ApplicationServices
2009-09-30 08:40:00.443 class-dump[473:903] Couldn't read file: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/ApplicationServices.framework/ApplicationServices
2009-09-30 08:40:00.449 class-dump[473:903] Couldn't read file: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/ApplicationServices.framework/ApplicationServices
class-dump: Input file (/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/ApplicationServices.framework/ApplicationServices) is neither a Mach-O file nor a fat archive. 
... etc (above warnings are very common when I run the perl script)

***But the most important thing, The script seems to fail in the end.

I got***

(after several warnings like above)
Framework: WebKit
    2009-09-30 08:40:24.228 class-dump[662:903] caught exception: expected (many things), got 260
    2009-09-30 08:40:24.232 class-dump[662:903] type: ^{WebDocumentLoaderMac=^^?iB^{Frame}{RefPtr<WebCore::MainResourceLoader>="m_ptr"^{MainResourceLoader}}{HashSet<WTF::RefPtr<WebCore::ResourceLoader>,WTF::PtrHash<WTF::RefPtr<WebCore::ResourceLoader> >,WTF::HashTraits<WTF::RefPtr<WebCore::ResourceLoader> > >="m_impl"{HashTable<WTF::RefPtr<WebCore::ResourceLoader>,WTF::RefPtr<WebCore::ResourceLoader>,WTF::IdentityExtractor<WTF::RefPtr<WebCore::ResourceLoader> >,WTF::PtrHash<WTF ... etc (I got many many lines of this kind of code in WebCore framework)

I wonder What I am doing wrong here? Do I need some additional settings?

I am using Mac OS 10.6.1 and would like to dump 3.0 frameworks in first place but my real aim is 3.1 frameworks

Any help would be very appreciated.

回答1:

From my understanding of undocumented APIs they are there. So in any app I could just call them.

From my understanding of class dumps, they are needed to discover undocumented APIs.

In Sadun's book she says, here's an undocumented-API call this to use it, include this in the header. Then you could use it.

My recommendation is don't use them.



回答2:

The version of class-dump included on Erica's site appears to be obsolete. A working version (as of iPhone OS 3.2, anyway) can be found here: http://www.codethecode.com/projects/class-dump/

Note: The script will still fail after doing a few frameworks; rather than fix the script, you can just manually run class-dump on the frameworks you care about.

ie:

cd /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/UIKit.framework
class-dump UIKit -H -o ~/temp/Headers/UIKit


回答3:

I think I've used DumpFrameworks a total of once, so I'm not all that familiar with it or why it is failing. However, IIRC, it just makes it easy to dump the info found in the headers.

As to where the header files are, do more than just cut and paste a script. Look at what the script does. It is clearly commented from whence it is pulling the public and private frameworks. Go to those directories, start drilling in, and you'll find the header files.

Include the frameworks in your project, import them where you wish to call the functions, and call the functions as they are listed in the headers.

Just in case you are not aware, calling undocumented APIs is a good way to get your app rejected by Apple.