Macos CorePlot托管视图和CPTXYGraph框架问题

Macos CorePlot托管视图和CPTXYGraph框架问题,macos,xcode5,core-plot,Macos,Xcode5,Core Plot,我正试图在我的OSX项目中,在Xcode 5中,按照以下教程设置一个简单的饼图: 问题是该图形不显示,并且CPTGraphHostingView和CPTXYGraph的高度和宽度均为0.00 下面是我使用的代码,之后我应该能够在视图中看到图表的标题。hostView是对xib文件中NSView的引用 -(void)configureHost { self.graphHostingView = [(CPTGraphHostingView *)[CPTGraphHostingView alloc]

我正试图在我的OSX项目中,在Xcode 5中,按照以下教程设置一个简单的饼图:

问题是该图形不显示,并且CPTGraphHostingView和CPTXYGraph的高度和宽度均为0.00

下面是我使用的代码,之后我应该能够在视图中看到图表的标题。hostView是对xib文件中NSView的引用

-(void)configureHost {
self.graphHostingView = [(CPTGraphHostingView *)[CPTGraphHostingView alloc] initWithFrame:CGRectMake(0, 0, 1103, 532)];

NSLog(@"%f", self.graphHostingView.frame.size.width);

[hostView addSubview:self.graphHostingView];
}

}

没有那么重要,但当我使用kCPTPlainWhiteTheme常量或其他主题常量时,我也会遇到一个错误。线程1:EXC\u BAD\u访问(代码=1,地址=0x0)

这可能是一个显而易见的问题,但我就是看不到。
提前感谢。

EXC\u BAD\u访问异常可能是链接问题。如何将核心绘图框架添加到项目中?你用的是什么版本?视图大小问题可能与在xib中配置视图的方式有关。我确实在将CorePlot文档集添加到我的项目中时遇到问题,因此我下载了一个示例CorePlot项目,然后将框架直接添加到我的项目中。只需拖动到我的项目。自定义vie位于一个与主窗口分离的窗口中。我不知道这是否有多大区别。当它加载并接受响应程序填充时,它将成为关键窗口。CorePlot版本为1.4,其xcode为5。经过更多测试,似乎CorePlot类实际上没有被分配或初始化。
-(void)configureGraph {
NSRect parentRect = CGRectMake(0, 0, 1103, 532);

//create graph
CPTGraph *graph = [[CPTXYGraph alloc] init];
[graph setFrame:parentRect];
NSLog(@"%f", graph.frame.size.width);
self.graphHostingView.hostedGraph = graph;
graph.paddingBottom = 0.0f;
graph.paddingLeft = 0.0f;
graph.paddingTop = 0.0f;
graph.paddingRight = 0.0f;
graph.axisSet = nil;

//text in graph
CPTMutableTextStyle *textStlye = [CPTMutableTextStyle textStyle];
textStlye.color = [CPTColor grayColor];
textStlye.fontName = @"Helvetica-Bold";
textStlye.fontSize = 16.0f;

//graph title
graph.title = @"Title";
graph.titleTextStyle = textStlye;
graph.titlePlotAreaFrameAnchor = CPTRectAnchorTop;
graph.titleDisplacement = CGPointMake(0.0f, -12.0f);

self.theme = [CPTTheme themeNamed:kCPTPlainWhiteTheme];