Adding a framework to XCode 4
of course i did research before posting my question.
I looked at
How to "add existing frameworks" in Xcode 4?
Adding Framework in Xcode 4
Adding an OpenGL framework in Xcode 4
XCode 4 adding dylib
but whole thing is becoming wrong.
My goal: Add (CorePlot) framework to XCode Mac project (not an iPhone one)
My environment: OSX Lion 10.7, SDK Lion, XCode 4.1 (4B110)
- Opened XCode, created new project
- Downloaded CorePlot into my libraries directory (like ~/Applications/LIBS)
- Opened project preferences, via (+) opened dialog to add framework
- Add existing framework (+ copy files to dest. group if needed)
- Selected directory was ~/Applications/LIBS/CorePlot/Binaries/MacOS/CorePlot.framework/
- DnD CorePlot to Frameworks Group
- Added CorePlot to
Build Phases > Link Binary with Libraries
and ran my project
what I got is this error message:
dyld: Library not loaded: @loader_path/../Frameworks/CorePlot.framework/Versions/A/CorePlot Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/metralight-hjuvuwlhgohrtdeepvcymnsaxomc/Build/Products/Debug/metralight.app/Contents/MacOS/metralight Reason: image not found
And in fact, when I looked into given directory (app bundle) there was no directory
Frameworks and so the linking cannot be successful
I have searched one more, and found, that I can create
Build Rule and copy files into final binary bundle via some script, but is this only way how to do this?
Isn’t there some option to just turn on/off copying linked frameworks to final bundle?
Note that CorePlot target ‘.framework’ has
Dynamic Library Install Name set to
@loader_path/../Frameworks/CorePlot.framework/Versions/A/CorePlot, so it is looking in right place in final binary bundle
2 Solutions Collect From Internet About “Adding a framework to XCode 4”
After adding framework via “Add existing framework”
- Go to
- In right bottom corner click
Add buid phase>
- Select Destination >
- Drag&Drop framework to files list
And that’s it.
Another important detail here – you must have the “Runtime search path” to be defined in the projects, it’s empty by default.
Something like this:
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks
- Unable to call an Objective C method from a C function
- Entitlements file do not match those specified in your provisioning profile.(0xE8008016)
- SKNode subclass generates error: cannot invoke initializer for type “X” with no arguments
- Open CV, image loading issue on Mac OS X
- Intermittent error accessing core data model / contacts database
- How to reload all tableview cells, while editing a textfield in a tableview cell – iOS Swift
- How do I prevent the iPhone screen from dimming or turning off while my application is running?
- GCM push notification to iOS with content_available (not working to invoke from inactive state)
- Programatically wake display on OSX
- Write to string in plist dictionary
- Add entry to iOS .plist file via Cordova config.xml
- iOS: Best way to make a UIScrollView with dynamic height?
- iPad detail settings page like popup viewController
- Is 'x?.y' in Swift the same as 'x?' followed by '.y'?
- Can a Swift Optional Int (Int?) be exposed to Objective-C via bridging?