2010-08-14 98 views
0

今天我试着用CorePlot编译一个项目。用CorePlot编译项目问题

所有的时间,我得到了以下错误:

".objc_class_name_NSNotificationCenter", referenced from: 
[email protected][email protected][email protected] in libCorePlot.a(CPGraph.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPXYPlotSpace.o) 
".objc_class_name_NSException", referenced from: 
[email protected][email protected][email protected] in libCorePlot.a(CPScatterPlot.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPBarPlot.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPGraph.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPGradient.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPLayer.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPXYPlotSpace.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPTheme.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPTradingRangePlot.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPAxisLabel.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPAxisTitle.o) 
[email protected][email protected][email protected] 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: 
[email protected][email protected][email protected] in libCorePlot.a(CPPlot.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPScatterPlot.o) 
[email protected][email protected][email protected] in libCorePlot.a(CPBarPlot.o)  [ . . . ] 

我希望有人能帮助我。

编辑:它的工作,如果我尝试编译设备,但不适合模拟器。

+0

你如何编译它? – kennytm 2010-08-14 21:48:06

回答

0

我似乎已经解决了我早些时候遇到的问题,但我最好猜测它只能通过添加其余代码来修复,它可能仍然隐藏在这7个其他错误的后面。我已经附加完整的视图controller.m文件更有经验的眼睛。

// 

// SOTC_CorePlotViewController.m // SOTC-CorePlot // // 创建者NFCU 98972在10年8月18日。 //版权2010 我的公司名称。版权所有。 //

导入 “SOTC_CorePlotViewController.h”

@implementation SOTC_CorePlotViewController

- (NSUInteger)numberOfRecords { 返回51; }

- (的NSNumber *)numberForPlot:(CPPlot )情节字段:(NSUInteger)fieldEnum
recordIndex:(NSUInteger)指数 { 双VAL =(索引/ 5.0)-5; if(fieldEnum == CPScatterPlotFieldX) {return [NSNumber numberWithDouble:val]; } else if(plot.identifier == @“X Squared Plot”) {return [NSNumber numberWithDouble:val
val]; } else {return [NSNumber numberWithDouble:1/val]; } } }

//实现viewDidLoad在加载视图后执行额外的设置,通常是从一个nib。 - (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]; 

}

  • (无效)didReceiveMemoryWarning { //发布视图,如果它不具有上海华。 [super didReceiveMemoryWarning];

    //发布任何未使用的缓存数据,图像等。 }

  • (void)viewDidUnload {super viewDidUnload]; //发布主视图的任何保留子视图。 //例如self.myOutlet = nil; }

  • (void)dealloc {super dealloc]; }

@end