Core-Plot 仅在发布配置中崩溃
我真的不知道解决方案,甚至不知道解决这个问题的方法 失败后。它仅发生在发布配置中 设备 - 模拟器和调试配置工作正常。也只 出现在第二次启动时。因此,如果我将手机连接到我的 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);
如果我评论最后一行,一切正常(当然 间隔长度不正确)。 我将不胜感激任何帮助! 提前致谢!
I really don't know a solution or even an idea to get around the
following failure. It only happens in Release Configuration on the
Device - Simulator and Debug Configuration work fine. It also only
appears on the second launch. So if I have the phone connected to my
mac, build the application and run it, everything works fine. If I
then close the app and restart, it crashes.
After long search, it seems that the error comes from the following
line:
x.majorIntervalLength = CPDecimalFromFloat(2.0f);
The code before:
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);
If I comment the last line, everything works fine (off course the
interval length is not correct).
I would appreciate any help!
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CPXYAxis *x = axisSet.xAxis;
是否有可能是nil
或未保留的 x?尚未对其进行检查。Any chance
CPXYAxis *x = axisSet.xAxis;
is an x that isnil
or not retained? It is not being checked for.