当前位置: 代码迷 >> Iphone >> 内存释放有关问题,求解
  详细解决方案

内存释放有关问题,求解

热度:93   发布时间:2016-04-25 06:46:52.0
内存释放问题,求解.
- (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];//这边释放就会崩溃了,何解?
}


------解决方案--------------------
要使用的内容已经被释放掉了。
  相关解决方案