this is part of my code:
NSMutableArray oldWordsArray;
newWordsArray= [self getNewWordArray];
-(NSMutableArray *) getOldWordArray{
NSString *user_id = (NSString*)[tool readObkect:@"user_id"];
NSMutableArray oldWords = [[NSMutableArray alloc]init];
oldWords = [database getOldWord:user_id];
NSLog(@"从所有词库中得到新单词");
return oldWords;
}`
So: how should I release Variable oldWordsArray
and oldWords
, many thanks!
I am guessing, that you are not using ARC. This:
Can be translated into this:
And then:
I am not sure what the
database
is, but it should return anautoreleased
object, so you don't have torelease
it yourself, in that context. You should as well, not use the prefixget
ingetOldWord
. You can as well, use anNSArray
instead of aNSMutableArray
.