Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6748111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:31:35+00:00 2026-05-26T12:31:35+00:00

Ok, so the issue is coming from trying to pull data from a sqlite

  • 0

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

The code is as follows:

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;

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:

“Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSPlaceholderDictionary initWithObjects:forKeys:]: number of objects (3) not equal to number of keys (8)'”

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?

Any help/direction would be greatly appreciated!

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:31:36+00:00Added an answer on May 26, 2026 at 12:31 pm

    Is the fourth item in your values array:

    [result stringForColumn:@"image_portrait"]
    

    returning nil? That’s the value that tells -initWithObjects that the list is done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Coming from Win32, I am having bit of an issue or a problem trying
Problem : Trying to sort an array coming from a typedef struct I created
I am trying to bind an ArrayCollection result coming in from the server to
So this error is coming from an attempt to solve another issue I am
I'm trying to get my JSON from my controller to my view. In my
I have an issue while trying to parse an Xml to Objects using Linq
I'm trying to run Python scripts using Xcode's User Scripts menu. The issue I'm
The issue is there is a database with around 20k customer records and I
Our issue is that our project has files being downloaded using wget to the
I'm trying to build a CSS-based table that will be populated with information coming

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.