下载sdk,地址https://code.google.com/p/core-plot/,我下载的是CorePlot_1.0
再readme文件下有两个说明文件:
README for Docs Install说明如何再xcode中安装帮助文档
README for Static Library Install 说明如何再项目中引入core-plot
我们先说一下如何运行CorePlot_1.0/Source/examples下面的example,我这次主要是要往ios中使用,因此试了几个example 只有“CorePlotGallery”符合我的要求,其他的或者是面向mac 的,或者是ios但编译不成功。
打开“Plot_Gallery_iOS.xcodeproj”,
由于core-plot是基于CorePlot-CocoaTouch.xcodeproj,因此project中包含了一个project。而且CorePlot-CocoaTouch.xcodeproj同一时间只能被一个工程使用,因此,如果你要多个工程同时运行的时候,需要将CorePlot_1.0拷贝一份,并在 header search path 中引入对应路径,如“/Users/user/Downloads/CorePlot_1.0/Source/framework/**”,注意,必须是递归
再target的build phase的target dependencies 中引入CorePlot-CocoaTouch,在 link binary with libraies中引入CorePlot-CocoaTouch中编译出来的libCorePlot-CocoaTouch.a,编译成功。
(注:我是在编译成功之后凭自己的记忆记录博客的,因此会有疏漏,但记录的都是我遇到比较典型的问题,希望对各位有帮助。)
这样子是调用了本地的源文件工程,不方便,我们可以摆脱CorePlot-CocoaTouch.xcodeproj的控制。过程如下。
移除 CorePlot-CocoaTouch.xcodeproj工程。将编译好的libCorePlot-CocoaTouch.a复制到frame下,并添加到target的link binary with libraies中,复制/CorePlot_1.0/Binaries/iOS/CorePlotHeaders文件夹到工程下
CorePlotGallery中,
Plots放置各种demo,
CorePlot-CocoaTouch.xcodeproj放置核心文件
**
出现错误:
2012-08-17 16:11:44.340 CorePlotTest3[21004:f803] -[__NSCFConstantString sizeWithTextStyle:]: unrecognized selector sent to instance 0x93cb8
2012-08-17 16:11:44.341 CorePlotTest3[21004:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString sizeWithTextStyle:]: unrecognized selector sent to instance 0x93cb8'
fix: build setting 的other linker flag 设为“-all_load -ObjC”
我刚开始设置的是(-ObjC-all_load ),出现上面错误,fuck!!!
****