我今天更新了xcode到7.3版本,突然使用CorePlot的模块抛出了错误。“图形不可用”和"dataSource不可用“。我从一开始就没有对这部分代码做过修改。我注意到有一个新版本的CorePlot --这是有帮助还是有坏处?
代码片段:
//1a - set up the 2 scatter plots - avg expected return for each portfolio
CPTScatterPlot *modelAvgRtnPlot = [[CPTScatterPlot alloc] init];
modelAvgRtnPlot.dataSource = self;
modelAvgRtnPlot.identifier = @"Portfolio A Expected Avg Return";
modelAvgRtnPlot.title = @"Model (A) Average Rtn";modelAvgRtnPlot.dataSource = self;行给出了编译错误'dataSource in unavailable‘
'graph‘的第二个问题--代码片段:
-(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index {
// 1 - Is the plot hidden?
if (plot.isHidden == YES) {
return;
}
// 2 - Create style, if necessary
static CPTMutableTextStyle *style = nil;
if (!style) {
style = [CPTMutableTextStyle textStyle];
style.color= [CPTColor darkGrayColor];
style.fontSize = 16.0f;
style.fontName = @"Raleway-Bold";
}
// 3 - Create annotation, if necessary
NSNumber *price = [self numberForPlot:plot field:CPTBarPlotFieldBarTip recordIndex:index];
if (self.priceDeviationAnnotation) {
[plot.graph.plotAreaFrame.plotArea removeAnnotation:self.priceDeviationAnnotation];
self.priceDeviationAnnotation = nil;
}在上面的代码中,[plot.graph.plotAreaFrame.plotArea...]给出了错误"'graph‘is unavailable“
发布于 2016-09-28 13:18:42
这里的是另一个解决方案:
我已经修复了这个问题,手册中的Xcode - BuildSetting -弱引用保留Release to 是并解决了。
发布于 2016-03-31 04:50:17
你在编译你的项目时没有启用ARC吗?最近在this github issue上有一些关于没有使用Xcode7.3编译ARC失败的项目的讨论。已在主分支中使用this commit修复此问题。
如果您现在无法升级到master,从给您带来问题的属性定义中删除cpt_weak应该可以修复您的编译错误。
https://stackoverflow.com/questions/36317473
复制相似问题