gpt4 book ai didi

iphone - [__NSArrayI count]:发送到已释放实例0x6dbfd10的消息

转载 作者:行者123 更新时间:2023-12-01 17:23:36 24 4
gpt4 key购买 nike

我正在使用Coreplot API创建条形图。当我尝试作为单个项目运行相同的代码时,它运行良好,但是当我将其集成到UINavigationController中的项目中时,这给我一个错误。
GraphView.h

    @interface GraphView : CPTGraphHostingView <CPTPlotDataSource, CPTPlotSpaceDelegate>
{
CPTXYGraph *graph;
NSArray *dates;
}
@property(nonatomic, retain) NSArray *dates;
GraphView.m
dates = [NSArray arrayWithObjects:@"2012-05-01", @"2012-05-02", @"2012-05-03", 
@"2012-05-04", @"2012-05-05", @"2012-05-06", @"2012-05-07", @"2012-05-08", @"2012-05-09",@"2012-05-10",@"2012-05-11",@"2012-05-12",@"2012-05-13",@"2012-05-14",@"2012-05-15",@"2012-05-16",@"2012-05-17",@"2012-05-18",@"2012-05-19",@"2012-05-20",nil];


- (NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot
{
return dates.count;
}

在返回dates.count,它给了我错误。

[__NSArrayI count]:发送到已释放实例0x6dbfd10的消息

最佳答案

您正在创建一个自动释放对象。将内存分配给日期数组。

dates =    [[NSArray alloc]initWithObjects:@"2012-05-01", @"2012-05-02", @"2012-05-03", 
@"2012-05-04", @"2012-05-05", @"2012-05-06", @"2012-05-07", @"2012-05-08", @"2012-05-09",@"2012-05-10",@"2012-05-11",@"2012-05-12",@"2012-05-13",@"2012-05-14",@"2012-05-15",@"2012-05-16",@"2012-05-17",@"2012-05-18",@"2012-05-19",@"2012-05-20",nil];

关于iphone - [__NSArrayI count]:发送到已释放实例0x6dbfd10的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13006526/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com