今天我尝试使用CorePlot编译项目。
我一直遇到以下错误:
".objc_class_name_NSNotificationCenter", referenced from:
literal-pointer@__OBJC@__cls_refs@NSNotificationCenter in libCorePlot.a(CPGraph.o)
literal-pointer@__OBJC@__cls_refs@NSNotificationCenter in libCorePlot.a(CPXYPlotSpace.o)
".objc_class_name_NSException", referenced from:
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPScatterPlot.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPBarPlot.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPGraph.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPGradient.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPLayer.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPXYPlotSpace.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPTheme.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPTradingRangePlot.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPAxisLabel.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPAxisTitle.o)
literal-pointer@__OBJC@__cls_refs@NSException in libCorePlot.a(CPXYAxis.o)
".objc_class_name_UIView", referenced from:
.objc_class_name_CPLayerHostingView in libCorePlot.a(CPLayerHostingView.o)
".objc_class_name_NSMutableArray", referenced from:
literal-pointer@__OBJC@__cls_refs@NSMutableArray in libCorePlot.a(CPPlot.o)
literal-pointer@__OBJC@__cls_refs@NSMutableArray in libCorePlot.a(CPScatterPlot.o)
literal-pointer@__OBJC@__cls_refs@NSMutableArray in libCorePlot.a(CPBarPlot.o) [ . . . ]
我希望有人可以帮助我。
编辑:如果我尝试编译设备而不是模拟器,它会工作。
答案 0 :(得分:0)
通过在projectsettings中设置标题搜索路径,我错过了包含框架的头文件。 =>双击Target => bild =>搜索标题搜索路径将值设置为: recursiv = YES 搜索和 ../ framework /
应该如下所示:
在此处下载框架:http://code.google.com/p/core-plot/downloads/detail?name=alpharelease_0.1.zip&can=2&q=
复制项目文件夹旁边的框架文件夹。
答案 1 :(得分:0)
我似乎已经解决了我之前遇到的问题,但我最好的猜测只是通过添加其余的代码来修复,它可能仍然隐藏在这7个其他错误背后。我已经附上了完整的视图controller.m文件,供更有经验的人使用。
//
// SOTC_CorePlotViewController.m // SOTC-CorePlot // //由NFCU 98972于8/18/10创建。 //版权所有2010 MyCompanyName 。版权所有。 //
@implementation SOTC_CorePlotViewController
- (NSUInteger)numberOfRecords { 返回51; }
- (NSNumber *)numberForPlot:(CPPlot )绘图字段:(NSUInteger)fieldEnum
recordIndex:(NSUInteger)指数
{
double val =(index / 5.0)-5;
if(fieldEnum == CPScatterPlotFieldX)
{return [NSNumber numberWithDouble:val]; }
其他
{
if(plot.identifier == @“X Squared Plot”)
{return [NSNumber numberWithDouble:val val]; }
其他
{return [NSNumber numberWithDouble:1 / val]; }
}
}
//在加载视图后,通常从nib实现viewDidLoad以进行其他设置。 - (void)viewDidLoad { [super viewDidLoad];
graph = [[CPXYGraph alloc] initWithFrame: self.view.bounds];
CPLayerHostingView *hostingView = (CPLayerHostingView *)self.view;
hostingView.hostedLayer = graph;
graph.paddingLeft = 20.0;
graph.paddingTop = 20.0;
graph.paddingRight = 20.0;
graph.paddingBottom = 20.0;
CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-6)
length:CPDecimalFromFloat(12)];
plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-5)
length:CPDecimalFromFloat(30)];
CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet;
CPLineStyle *lineStyle = [CPLineStyle lineStyle];
lineStyle.lineColor = [CPColor blackColor];
lineStyle.lineWidth = 2.0f;
axisSet.xAxis.majorIntervalLength = [NSDecimalNumber decimalNumberWithString:@"5"];
axisSet.xAxis.minorTicksPerInterval = 4;
axisSet.xAxis.majorTickLineStyle = lineStyle;
axisSet.xAxis.minorTickLineStyle = lineStyle;
axisSet.xAxis.axisLineStyle = lineStyle;
axisSet.xAxis.minorTickLength = 5.0f;
axisSet.xAxis.majorTickLength = 7.0f;
axisSet.xAxis.axisLabelOffset = 3.0f;
axisSet.yAxis.majorIntervalLength = [NSDecimalNumber decimalNumberWithString:@"5"];
axisSet.yAxis.minorTicksPerInterval = 4;
axisSet.yAxis.majorTickLineStyle = lineStyle;
axisSet.yAxis.minorTickLineStyle = lineStyle;
axisSet.yAxis.axisLineStyle = lineStyle;
axisSet.yAxis.minorTickLength = 5.0f;
axisSet.yAxis.majorTickLength = 7.0f;
axisSet.yAxis.axisLabelOffset = 3.0f;
CPScatterPlot *xSquaredPlot = [[[CPScatterPlot alloc]
initWithFrame:graph.defaultPlotSpace.bounds] autorelease];
xSquaredPlot.identifier = @"X Squared Plot";
xSquaredPlot.dataLineStyle.lineWidth = 1.0f;
xSquaredPlot.dataLineStyle.lineColor = [CPColor redColor];
xSquaredPlot.dataSource = self;
[graph addPlot:xSquaredPlot];
CPPlotSymbol *greenCirclePlotSymbol = [CPPlotSymbol ellipsePlotSymbol];
greenCirclePlotSymbol.fill = [CPFill fillWithColor:[CPColor greenColor]];
greenCirclePlotSymbol.size = CGSizeMake(2.0, 2.0);
xSquaredPlot.defaultPlotSymbol = greenCirclePlotSymbol;
CPScatterPlot *xInversePlot = [[[CPScatterPlot alloc]
initWithFrame:graph.defaultPlotSpace.bounds] autorelease];
xInversePlot.identifier = @"X Inverse Plot";
xInversePlot.dataLineStyle.lineWidth = 1.0f;
xInversePlot.dataLineStyle.lineColor = [CPColor blueColor];
xInversePlot.dataSource = self;
[graph addPlot:xInversePlot];
}
(void)didReceiveMemoryWarning { //如果视图没有超视图,则释放视图。 [super didReceiveMemoryWarning];
//释放未使用的任何缓存数据,图像等。 }
(void)viewDidUnload { [super viewDidUnload]; //释放主视图的所有保留子视图。 //例如self.myOutlet = nil; }
(void)dealloc { [super dealloc]; }
@end