ios - iPhone private API compiling -


i'm searching through whole internet since few hours now, , can't find informations i'm looking for. mess around private apis, see whats possible, etc., can't compile something.

so i've got few pretty basic questions:

  • do have dump headers? because downloaded sample, api loaded
char *framework = "/system/library/privateframeworks/..."; dlopen(...); 

i use objc-syntax (if possible) rather using c (as mentioned above), if there opportunities.

  • how make xcode compile, if import private apis? have add other link flags? (because read 2 different opinions) added private framework , created new folder "headers" , put headers files in there, framework shows correctly in xcode. have import whole .framework, or headers framework use? after imported framework, 20+ errors, unknown type names, , many more.

and, finally, i've read entitlements (which seem new in ios 7). how use these entitlements , when use them?

could please type few lines example?

background

in order use methods in any framework, can choose either reference frameworks statically or dynamically. haven't seen in question suggests need use dynamic linking, i'm going avoid (it's more complicated beginner). (‡)

to statically reference apis in framework, import relevant headers, , configure xcode project link framework. these 2 steps change slightly private apis.

private apis don't provide headers (*.h) describe apis. "usually", because sometimes, api that's private on ios public on mac os x, use it, copy os x version of header project.

generating headers

probably more common, though, have generate header yourself. if know header need, can find posted online under someone's github account. if not, need tool class-dump, or class-dump-z. run class dump tool on private framework, finding on mac:

cd /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos7.0.sdk/system/library/privateframeworks/ class-dump -h -o ~/headers/7.0/musiclibrary/ musiclibrary 

then, go ~/headers/7.0/musiclibrary/ , find lots of dumped header files. copy (only) header(s) need xcode ios project directory. then, inside xcode, right click on source folder in project navigator view, select "add files <project name> ...". pick dumped header file need include in project.

linking

in order link against api, need add framework xcode build phases. project target settings, select build phases link binary libraries. choose public framework default list ios sdk provides you. however, can choose browse mac 3rd-party frameworks, or private frameworks, too. private frameworks, you're going have navigate folder location this

/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos7.0.sdk/system/library/privateframeworks/ 

and pick *.framework directory.

then, use apis use public/private api. #import header file, call apis, instantiate classes, etc.

the use of code:

char *framework = "/system/library/privateframeworks/..."; dlopen(...); 

is attempt dynamically open private framework. that's not necessary, if know @ compile time framework want use, , have present on mac let xcode link against.

entitlements

entitlements not new ios 7. have existed quite time, , 1 technique ios uses prevent unauthorized usage of private apis. ios check see if app has been granted particular entitlement (by name), , if not have entitlement, calling protected api fail (usually silently, although you'll see message in console log).

see here example of granting (jailbreak) app entitlement.


(‡) update: ios 9.3 has brought changes respect private apis, , static vs dynamic linking. please see stack overflow question here more.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -