首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

内存释放有关问题,求解

2012-03-25 
内存释放问题,求解.- (NSMutableArray*)findContactInfoWithuseid:(NSString*)userid{NSMutableArray *lis

内存释放问题,求解.
- (NSMutableArray*)findContactInfoWithuseid:(NSString*)userid
{
NSMutableArray *list = [[[NSMutableArray alloc]init]autorelease];
//ResultSet *rs = [[DBHelper sharedInstance].database executeQuery:@"SELECT * FROM PliceContact where userId = ?",userid];
ResultSet *rs = [[DBHelper sharedInstance].database executeQuery:@"SELECT * FROM PliceContact where userId"];
while([rs next]) {
ContactInfo *info = [[ContactInfo alloc] init];
info._userId = [rs stringForColumnIndex: 0];
info._department = [rs stringForColumnIndex: 1];
info._userName = [rs stringForColumnIndex: 2];
info._recordId = [rs stringForColumnIndex: 3];
[list addObject:info];
[info release];
}
return list;
}

- (void)getPoliceListData{
NSLog(@"get the list");
NSMutableArray *resultArray = [[NSMutableArray alloc] init];
resultArray = [[TableMaintenance sharedInstance] findContactInfoWithuseid:@"1"];
NSLog(@"resultArray = %@",resultArray);

[resultArray release];//这边释放就会崩溃了,何解?
}


[解决办法]
要使用的内容已经被释放掉了。

热点排行