I have an array declared inside a user defined method. I use this array to store the values returned from the sqlite database. Then I use that value for further processing… But Xcode gives me the following warning at the array declaration.
“Value stored during initialization is never being read”
Here is my code:
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];
Please help me out of this.
Note dbConnection is the database connection object and fetchColumnFromTable is a user defined method which returns the array of values fetched from database. Then i get the first value in NSNumber and convert it into integer to use it in my code. I get the above warnning at the declaration of the tempId array.
NSMutableArray *tempId=[NSMutableArray array];is not necessary as the memory allocated by this statement is not used and you are pointing tempId to the array returned attempId=[appDelegate.dbConnection fetchColumnFromTable:sql1 col:0];. So basically you can just declare the array and not initialise it.NSMutableArray *tempId;