Iphone 我不知道如何修补漏洞
这里的漏洞怎么修Iphone 我不知道如何修补漏洞,iphone,Iphone,这里的漏洞怎么修 -(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { if(searching){ return nil; } NSMutableArray *tempArray = [[NSMutableArray alloc] init]; [tempArray addObject:UITableViewIndexSearch]; [tempArray addObject:@"
-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
if(searching){
return nil;
}
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
[tempArray addObject:UITableViewIndexSearch];
[tempArray addObject:@"A"];
[tempArray addObject:@"B"];
[tempArray addObject:@"C"];
[tempArray addObject:@"D"];
[tempArray addObject:@"E"];
[tempArray addObject:@"F"];
[tempArray addObject:@"G"];
[tempArray addObject:@"H"];
[tempArray addObject:@"I"];
[tempArray addObject:@"J"];
[tempArray addObject:@"K"];
[tempArray addObject:@"L"];
[tempArray addObject:@"M"];
[tempArray addObject:@"N"];
[tempArray addObject:@"O"];
[tempArray addObject:@"P"];
[tempArray addObject:@"Q"];
[tempArray addObject:@"R"];
[tempArray addObject:@"S"];
[tempArray addObject:@"T"];
[tempArray addObject:@"U"];
[tempArray addObject:@"V"];
[tempArray addObject:@"W"];
[tempArray addObject:@"X"];
[tempArray addObject:@"Y"];
[tempArray addObject:@"Z"];
return tempArray;
}
任何帮助都将不胜感激
Sam您应该返回一个自动释放的对象:
return [tempArray autorelease];
当您获得temparray时,调用
[#<your var># release];
[##发布];
来解决你的漏洞。自动释放可以工作,但您需要设置一个NSAutoRelease池,并在完成后将其排空,以防止实际泄漏(因为唯一的自动释放池在开始时位于main()中,因此程序在退出之前不会释放)。干杯,这修复了该特定问题。。现在来解决其他问题。sighmain()自动释放池在每个运行循环中都被排空,而不是在程序结束时。是的,自动释放池在运行循环中被排空。(或者我相信当程序需要时)