Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 核心绘图:内存问题核心动画无法分配这么多字节_Ios_Core Plot - Fatal编程技术网

Ios 核心绘图:内存问题核心动画无法分配这么多字节

Ios 核心绘图:内存问题核心动画无法分配这么多字节,ios,core-plot,Ios,Core Plot,我正在使用core plot使用Web服务生成各种类型的图形。但在生成大约60个图形后,graph scren似乎为空,在设备日志中显示一条消息“core animation未能分配9997432字节” 我们只在应用程序在模拟器上运行良好的设备上面临这个问题 下面是代码片段,我们将数据从另一个类传递到下面的类。 .h文件 // //线形图 //图表 // //由Pawan于2011年12月12日创建。 //版权所有2011年uu MyCompanyName uuu。版权所有。 // #进口 #导

我正在使用core plot使用Web服务生成各种类型的图形。但在生成大约60个图形后,graph scren似乎为空,在设备日志中显示一条消息“core animation未能分配9997432字节” 我们只在应用程序在模拟器上运行良好的设备上面临这个问题

下面是代码片段,我们将数据从另一个类传递到下面的类。 .h文件

//
//线形图
//图表
//
//由Pawan于2011年12月12日创建。
//版权所有2011年uu MyCompanyName uuu。版权所有。
//
#进口
#导入“CorePlot CoCoCoTouch.h”
@接口线条图1:UIViewController{
NSMutableArray*xAxisValuesArray;
NSMutableArray*yAxisValuesArray;
NSMUTABLEARRY*标识阵列;
NSMutableArray*xaxisscalarray;
NSMutableArray*格式化数据标签阵列;
NSString*graphTitleLabel;
NSString*线型;
NSString*XaxistitElabel;
NSString*yAxisMin;
NSString*yAxisMax;
NSString*yAxisIntervalLength;
NSString*yAxisTitle;
NSString*yAxisTitleLocation;
UILabel*valueLabel2;
浮点数;
浮动间隔长度;
@私人的
CPTXYGraph*线图;
CPTMutableTextStyle*titleTextStyle;
CPTLayerAnnotation*symbolTextAnnotation;
NSMUTABLEARRY*plotSymbolColoursArray;
NSMutableArray*PlotlineColorySarray;
IBOutlet CPTGraphHostingView*线图视图;
IBUILabel*线图标签;
IBUISLIDER*线图值滑块;
IBUIButton*钻取按钮;
IBUIButton*drillDownButton;
IBUIButton*帮助按钮;
}
@属性(非原子,保留)IBOutlet CPTGraphHostingView*linegraphview;
@属性(非原子,保留)CPTXYGraph*lineGraph;
@属性(非原子,保留)NSMutableArray*XaxiValuesArray;
@属性(非原子,保留)NSMutableArray*yAxisValuesArray;
@属性(非原子,保留)IBUILabel*lineGraphLabel;
@属性(非原子,保留)NSString*graphTitleLabel;
@属性(非原子,保留)NSString*线型;
@属性(非原子,保留)NSString*XaxistitElabel;
@属性(非原子,保留)NSString*yAxisTitleLocation;
@属性(非原子,保留)NSString*yAxisMin;
@属性(非原子,保留)NSString*yAxisMax;
@属性(非原子,保留)NSString*yAxisIntervalLength;
@属性(非原子,保留)NSString*yAxisTitle;
@属性(非原子,保留)NSMutableArray*identifierArray;
@属性(非原子,保留)NSMUTABLEARRY*plotSymbolColoursArray;
@属性(非原子,保留)NSMutableArray*PlotlineColorsArray;
@属性(非原子,保留)NSMutableArray*XaxisScalArray;
@属性(非原子,保留)NSMutableArray*formattedDataLabelArray;
@属性(非原子,保留)CPTMutableTextStyle*titleTextStyle;
-(void)ConstructionLineGraphForSingleLineGraph:(NSString*)类型;
-(iAction)帮助按钮按下:(id)发件人;
-(void)plotDataActionSlider:(id)发送方;
-(void)setplotDataActionSlider;
@结束
.m文件
//线条图
//图表
//
//由Pawan于2011年12月12日创建。
//版权所有2011年uu MyCompanyName uuu。版权所有。
//
#导入“LineGraph1.h”
#导入“CommonMethodForGraphs.h”
#导入“GraphDescription.h”
@实现线图1
@综合线图;
@合成沙雷;
@合成雅西沙雷;
@合成石墨标签;
@合成线谱标签;
@综合线型;
@合成xAxisTitleLabel;
@合成雅西明;
@合成yAxisMax;
@综合间隔长度;
@合成雅克斯提特;
@综合现有定位;
@综合识别阵列;
@合成绘图仪;
@合成色谱仪;
@合成Xaxiscalarray;
@合成格式化数据标签阵列;
@合成滴定柱;
@综合线图视图;
//实现viewDidLoad以在加载视图(通常从nib)后执行附加设置。
-(无效)viewDidLoad{
[超级视图下载];
[自设置PlotDataActionSlider];
self.lineGraphLabel.text=self.graphTitleLabel;
NSMutableArray*identifierLocalArray=[[NSMutableArray alloc]init];
[identifierLocalArray插入对象:@“端口在”索引:0];
self.identifierArray=identifierLocalArray;
[identifierLocalArray释放];
NSMUTABLEARRY*plotSymbolColoursLocalArray=[NSMUTABLEARRY arrayWithObjects:[CPTColor redColor],[CPTColor greenColor],nil];
NSMUTABLEARRY*PLOTLINECLOURESLOCALARRAY=[NSMUTABLEARRY arrayWithObjects:[CPTColor greenColor],[CPTColor redColor],nil];
self.plotsymbolcolorsarray=plotsymbolcolorsolarray;
self.plotlinecolorsarray=plotlinecolorsolarray;

if([self.xAxisValuesArray count]不确定这是否会造成很大差异,但这两种方法似乎使用了不同的逻辑

-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot 
{
int recordCount = 0;

for (int i=0; i<[self.identifierArray count]; i++) 
{
    if ( [plot.identifier isEqual:[self.identifierArray objectAtIndex:i] ]) 
    {
        recordCount= [self.yAxisValuesArray count];
    }
}
return recordCount; 
我建议使用与中相同的逻辑

-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
用另一种方法

-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index

如果您的图表中同时有60个图形,您能确认只有一个绘图吗?

如果是这样,您的内存或用于核心动画的其他GPU资源可能已经用完。请确保释放不再使用的图形和/或绘图以释放资源。

我们已经释放了CPTXYGraph*lineGraph,iBootlet CPTGraphHostingView*LineGraphView并从line graph中删除CPTSatterPlot*dataSourceLinePlot,尽管如此,应用程序在60个报告后崩溃。请让我们知道是否需要进行任何进一步的更改。嗨,Damien,我们已更改了上述代理下的逻辑,现在两个代理中都存在相同的逻辑/代码。尽管如此es建议我们仍然面临这个问题。有人能告诉我们代码中是否有错误吗。
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index