I am guessing, that you are not using ARC. This:
-(NSMutableArray *) getOldWordArray{
NSString *user_id = (NSString*)[tool readObkect:@"user_id"];
NSMutableArray oldWords = [[NSMutableArray alloc]init];
oldWords = [database getOldWord:user_id];
NSLog(@"从所有词库中得到新单词");
return oldWords;
}
Can be translated into this:
-(NSArray *) getOldWordArray{
NSString *user_id = (NSString*)[tool readObkect:@"user_id"];
NSArray oldWords = [database getOldWord:user_id];
NSLog(@"从所有词库中得到新单词");
return oldWords;
}
And then:
- (NSArray *)oldWordArray
{
NSString *user_id = (NSString*)[tool readObkect:@"user_id"];
return [database getOldWord:user_id];
}
I am not sure what the database
is, but it should return an autoreleased
object, so you don't have to release
it yourself, in that context. You should as well, not use the prefix get
in getOldWord
. You can as well, use an NSArray
instead of a NSMutableArray
.