importing private frameworks in Xcode

2019-03-20 09:53发布

问题:

I am a novice iPhone programmer I want to use some of the functions in the private framework

https://github.com/kennytm/iphone-private-frameworks

The function that I want to use is in 'SpringBoard'

So I downloaded 'SpringBoard' folder in that github repo. And created a subdirectory called "Headers" in 'SpringBoard' and put all the header files in that folder.

And renamed 'SpringBoard' to 'SpringBoard.framework' and copied it to /Developer/Platforms/(iPhoneOS_and_iPhoneSimulator)/sdks/System/library/Frameworks folder (I can't recall full path correctly sorry)

And I got back to the xcode and right click on Frameworks -> Add existing framework -> other -> I selected 'SpringBoard.framework' folder and clicked Add.

And I built the project and got an error

'ld : framework SpringBoard not found'

My imported framework does appear on the Xcode and I can see header files in it. but when I built it I got that error.

What am I doing wrong?

回答1:

Place all of your private headers in a directory like: /User/Name/Headers/ then set USER_HEADER_SEARCH_PATHS = "/User/Name/Headers/" and make sure that ALWAYS_SEARCH_USER_PATHS = YES

Also, SpringBoard.framework is not the way to do that.Simply place the folder named SpringBoard in the above Headers folder, making sure that the headers are directly inside them. For instance: SpringBoard/SBAlert.h

/*  SpringBoard is not a framework.  */

Notice that you wont have to add the SpringBoard folder to your project, they should appear as you start typing, as long as you set the above headers correctly.



回答2:

I'm not sure if this works, but here a suggestion: I think the spring board framework should be in the UIKit framework you already linked anyway, so just add the header file to your project and it should work.

Otherwise this could help you: http://www.codethecode.com/projects/class-dump/