Core-Plot 仅在发布配置中崩溃

发布于 2024-09-03 17:12:22 字数 1676 浏览 8 评论 0原文

我真的不知道解决方案,甚至不知道解决这个问题的方法 失败后。它仅发生在发布配置中 设备 - 模拟器和调试配置工作正常。也只 出现在第二次启动时。因此,如果我将手机连接到我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

轻拂→两袖风尘 2024-09-10 17:12:22

CPXYAxis *x = axisSet.xAxis; 是否有可能是 nil 或未保留的 x?尚未对其进行检查。

Any chance CPXYAxis *x = axisSet.xAxis; is an x that is nil or not retained? It is not being checked for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文