crash happens when NSMutableArray is returned?
Posted
by senthilmuthu
on Stack Overflow
See other posts from Stack Overflow
or by senthilmuthu
Published on 2010-03-16T08:38:33Z
Indexed on
2010/03/16
8:46 UTC
Read the original article
Hit count: 156
iphone
|iphone-sdk
Hi, I have coded like that(that function will be called again and again), but the returned object gives "BAD ACCESS", the NSLog prints correct string, but toReturn sometimes(i called again and again) gives crashes..any help to alter this code
- (NSMutableArray *)getAll:(NSString *)type
{
NSLog(@"Type: %@", type);
NSMutableArray *toReturn = [[NSMutableArray alloc] initWithCapacity:0] ;
rs = [db executeQuery:Query1];
while ([rs next]) {
[toReturn addObject:[rs stringForColumn:@"Name"]];
NSLog(@"name: %@", [rs stringForColumn:@"Name"]);
}
[rs close];
return toReturn;
}
© Stack Overflow or respective owner