我用下面的代码:分配错误NSString?
for (int i=1; i<=3;i++){
NSString *theString = [[NSString alloc] initWithFormat:@"%i",imageValue];
theString = [theString stringByAppendingFormat:@"%i.jpg",i];
[img addObject:theString];
NSLog(@"the string %@:",theString); //01.jpg ,02.jpg and 03.jpg
[theString release];
}
,但我得到这个错误3次,为什么?
错误:
myapp(15467,0xacdaa2c0) malloc: *** error for object 0x4eb1ca0: pointer being freed was not allocated