Note that there are some explanatory texts on larger screens.

plurals
  1. PONumber of Objects (3) not equal to number of keys(8)
    primarykey
    data
    text
    <p>Ok, so the issue is coming from trying to pull data from a sqlite DB and place it in an array for a scroll view display. Im using FM Database library to connect to sql database</p> <p>The code is as follows:</p> <pre><code>NSMutableArray *data = [[NSMutableArray alloc] init]; FMResultSet *result = [[[StorageTank sharedStorageTank] DB] executeQuery:@"SELECT * FROM table"]; while([result next]) { NSArray *values = [[NSArray alloc] initWithObjects: [[NSNumber alloc] initWithInt:[result intForColumn:@"id"]], [[NSNumber alloc] initWithInt:[result intForColumn:@"count"]], [[NSNumber alloc] initWithInt:[result intForColumn:@"required"]], [result stringForColumn:@"image_portrait"], [result stringForColumn:@"image_landscape"], [[NSNumber alloc] initWithInt:[result intForColumn:@"end_date"]], [[NSNumber alloc] initWithInt:[result intForColumn:@"active"]], [result stringForColumn:@"merchant"], nil]; NSLog(@"%@", values); NSArray *keys = [[NSArray alloc] initWithObjects: @"id",@"count",@"required", @"image_portrait",@"image_landscape", @"end_date",@"active",@"merchant",nil]; NSLog(@"%@", keys); NSDictionary *row = [[NSDictionary alloc] initWithObjects: values forKeys: keys]; [data addObject: row]; } NSArray *resultArray = [[NSArray alloc] init]; resultArray = data; </code></pre> <p>So, obviously from the code i've tested to make sure the values count is equal to the keys count... yet Im still getting this error: </p> <p>"Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSPlaceholderDictionary initWithObjects:forKeys:]: number of objects (3) not equal to number of keys (8)'"</p> <p>I can't understand for the life of me why the count would differ if when I print out the values array I see 8 values... which should match my 8 keys? and they are correct? </p> <p>Any help/direction would be greatly appreciated!</p> <p>Thanks,</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload