我有一个用户定义的方法内声明的数组。我使用这个数组来存储从sqlite数据库返回的值。然后我使用该值进行进一步处理......但Xcode在数组声明中给了我下面的警告。 “在初始化过程中存储的值永远不会被读取” 这里是我的代码:内存泄漏警告
NSMutableArray *tempId=[NSMutableArray array];
NSString *sqlStr1=[NSString stringWithFormat:@"select deck_id from decksTable limit '%d' offset '%d'",1,deckID-1];
char *sql1 = (char*)[sqlStr1 UTF8String];
tempId=[appDelegate.dbConnection fetchColumnFromTable:sql1 col:0];
NSNumber *tempint1 =[tempId objectAtIndex:0];
int actualDeckID=[tempint1 intValue];
请大家帮我出这一点。
注意dbConnection是数据库连接对象,而fetchColumnFromTable是用户定义的方法,它返回从数据库获取的值数组。然后我得到NSNumber中的第一个值,并将其转换为整数,以便在我的代码中使用它。我在tempId数组的声明中得到了上面的警告。
可能的重复:http://stackoverflow.com/questions/2646582/clang-error-objective-c-value-stored-during-initialization-is-never-read –