【问题标题】:Core-Plot crash only in Release ConfigurationCore-Plot 仅在发布配置中崩溃
【发布时间】:2010-06-03 16:13:24
【问题描述】:

我真的不知道解决方案甚至是解决问题的想法 失败后。它只发生在发布配置中 设备 - 模拟器和调试配置工作正常。它也只 出现在第二次发射。所以如果我把手机连接到我的 mac,构建应用程序并运行它,一切正常。如果我 然后关闭应用程序并重新启动,它崩溃了。 经过长时间的搜索,似乎错误来自以下 行:

x.majorIntervalLength = CPDecimalFromFloat(2.0f); 

之前的代码:

               CPLayerHostingView *chartView = [[CPLayerHostingView 
alloc] initWithFrame:CGRectMake(0, 0, 320, 160)]; 
                [self addSubview:chartView]; 
                // create an CPXYGraph and host it inside the view 
                CPTheme *theme = [CPTheme themeNamed:kCPPlainWhiteTheme]; 
                CPXYGraph *graph = (CPXYGraph *)[theme newGraph]; 
                chartView.hostedLayer = graph; 
                graph.paddingLeft = 20.0; 
                graph.paddingTop = 10.0; 
                graph.paddingRight = 10.0; 
                graph.paddingBottom = 20.0; 
                CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace; 
                plotSpace.xRange = [CPPlotRange 
plotRangeWithLocation:CPDecimalFromFloat(0) 
                                                                                                           length:CPDecimalFromFloat(100)]; 
                plotSpace.yRange = [CPPlotRange 
plotRangeWithLocation:CPDecimalFromFloat(0) 
                                                                                                           length:CPDecimalFromFloat(10)]; 
                CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet; 
                CPXYAxis *x = axisSet.xAxis; 
                x.majorIntervalLength = CPDecimalFromFloat(2.0f); 

如果我评论最后一行,一切正常(当然 间隔长度不正确)。 我将不胜感激任何帮助! 提前致谢!

【问题讨论】:

  • 它是如何崩溃的?它会在 EXC_BAD_ACCESS 上引发异常或崩溃吗?你能从断点开始,看看它在 CPDecimalFromFloat() 函数中停止的位置吗?

标签: iphone release core-plot


【解决方案1】:

CPXYAxis *x = axisSet.xAxis; 是否有可能是 nil 或未保留的 x?它没有被检查。

【讨论】:

  • 嗯,不幸的是没有。我现在检查了它,它是具有正确值的正确对象。
猜你喜欢
  • 2012-10-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多