Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.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/4/regex/16.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_Objective C_Memory Leaks - Fatal编程技术网

Ios 对象自动释放的次数太多

Ios 对象自动释放的次数太多,ios,objective-c,memory-leaks,Ios,Objective C,Memory Leaks,在这些行中,对象自动释放的次数太多了。 换言之,具体如下: 方法返回一个带有+0保留计数的Objective-C对象 2,对象已自动释放,但保留计数为+0 NIDropDown: noArc,而NIDropDown是Arc 我用另一种方法试过 @property(nonatomic, retain) NIDropDown *rangeDropDown; @property(nonatomic, retain) NIDropDown *filterDropDown; self.rangeDrop

在这些行中,对象自动释放的次数太多了。 换言之,具体如下:

方法返回一个带有+0保留计数的Objective-C对象

2,对象已自动释放,但保留计数为+0

NIDropDown:

noArc,而NIDropDown是Arc

我用另一种方法试过

@property(nonatomic, retain) NIDropDown *rangeDropDown;
@property(nonatomic, retain) NIDropDown *filterDropDown;

self.rangeDropDown = [[[NIDropDown alloc]showDropDown:btn height:f dataSource:rangeArr imageData:nil direction:@"down"]autorelease];

self.filterDropDown = [[[NIDropDown alloc]showDropDown:btn height:f dataSource:filterArr imageData:nil direction:@"down"]autorelease];
两者都是一个物体的潜在泄漏。 1:方法返回具有+1保留计数的Object-C对象

2:对象泄漏:分配的对象稍后不会在此执行路径中引用,并且保留计数为+1


但是,它没有坠毁。如何避免这些潜在的泄漏?

为什么不使用ARC?在我看来,您缺少了一个初始化。@godel9-这很可能会混淆分析仪。不管是谁用这种方式写的,都应该用一个湿字符串打十下睫毛。从源头上看,这完全是错误的。self.table=UITableView*[super init];-那是怎么回事?是的,我给OP的建议是不要用那个软件包。
@interface SelectorView(){
    NIDropDown *_rangeDropDown;
    NIDropDown *_filterDropDown;
}

 _rangeDropDown = [[[NIDropDown alloc]showDropDown:btn height:f dataSource:rangeArr imageData:nil direction:@"down"]autorelease];

 _filterDropDown = [[[NIDropDown alloc]showDropDown:btn height:f dataSource:filterArr imageData:nil direction:@"down"]autorelease];

or 

_rangeDropDown = [[NIDropDown alloc]showDropDown:btn height:f dataSource:rangeArr imageData:nil direction:@"down"];

 _filterDropDown = [[NIDropDown alloc]showDropDown:btn height:f dataSource:filterArr imageData:nil direction:@"down"];