问题
I am trying to install Core Plot into my iOS app. I have followed the instructions on the Core Plot website but they are very brief and have no screenshots. I have pasted the instructions below and explained where I am stuck...
First, drag the CorePlot-CocoaTouch.xcodeproj file into your iPhone application's Xcode project. Show the project navigator in the left-hand list and click on your project.
Select your application target from under the "Targets" source list that appears. Click on the "Build Phases" tab and expand the "Target Dependencies" group. Click on the plus button, select the CorePlot-CocoaTouch library, and click Add. This should ensure that the Core Plot library will be built with your application.
Done!
Core Plot is built as a static library for iPhone, so you'll need to drag the libCorePlot-CocoaTouch.a static library from under the CorePlot-CocoaTouch.xcodeproj group to the "Link Binaries With Libraries" group within the application target's "Build Phases" group you were just in.
Done!
You'll also need to point to the right header location. Under your Build settings, set the Header Search Paths to the relative path from your application to the framework/ subdirectory within the Core Plot source tree. Make sure to make this header search path recursive. You need to add -ObjC to Other Linker Flags as well (as of Xcode 4.2, -all_load does not seem to be needed, but it may be required for older Xcode versions).
I dont understand this bit!
Core Plot is based on Core Animation, so if you haven't already, add the QuartzCore framework to your application project.
Done!
Finally, you should be able to import all of the Core Plot classes and data types by inserting the following line in the appropriate source files within your project:
#import "CorePlot-CocoaTouch.h"
Done!
Is anyone able to put the instruction I am struggling with into more laymans terms?
回答1:
Seeing as how I wrote those instructions, I can take a stab at clarifying the part you're having trouble with.
You'll need to set the header search path so that when you include CorePlot-CocoaTouch.h
, Xcode knows where to pull that from. This is located within the Build Settings for your application project under the Header Search Paths build setting. It looks like the following:
Double-click on the field for the header search paths and bring up this popup:
The path you specify here is the relative path from your Xcode project file to the directory where you installed Core Plot. In my case, I had both my application project directory and Core Plot located within the same ~/Development directory, so the relative path involved stepping back a level (the ../
) and going to the core-plot
directory that I had cloned the framework into. You then need to point to the framework
subdirectory, where the actual framework source is stored.
Finally, checking the little box to the left of the path makes the header search recursive, so it will find headers contained in subdirectories of this one.
As far as the linker flags go, find your Other Linker Flags within these same Build Settings and add -ObjC
to the list of linker flags:
This is needed so that symbols from the categories we use in the static library get pulled into your project properly. As I indicate, we used to need to add -all_load
to this as well to work around a linker bug, but LLVM in Xcode 4.2 fixes this. That's good, because -all_load
sometimes introduced duplicate symbols and broke building against certain third-party frameworks.
Hopefully, this should clear up that particular section of the instructions. I tried to do my best to make those easy to follow and keep them up to date with the latest Xcode versions, but perhaps I wasn't detailed enough. If you got through all the rest of the steps fine, you should be good to go.
回答2:
The easiest way is to include the core-plot .h files and the library binary files (the .a file).
You just drag them all into the project.
Cheers.
来源:https://stackoverflow.com/questions/10260291/installing-core-plot-in-xcode-4-2-for-ios-project