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

  • SEARCH
  • Home
  • 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 6081721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:12:28+00:00 2026-05-23T11:12:28+00:00

I have a database app i am making and i can extract the results

  • 0

I have a database app i am making and i can extract the results from a sqlite database and put them in the table, however i need to make them sort alphabetically in sections.

So now i have this code

AArray = [[NSMutableArray alloc] init];
    BArray = [[NSMutableArray alloc] init];
    CArray = [[NSMutableArray alloc] init];
    DArray = [[NSMutableArray alloc] init];
    EArray = [[NSMutableArray alloc] init];
    FArray = [[NSMutableArray alloc] init];
    GArray = [[NSMutableArray alloc] init];
    HArray = [[NSMutableArray alloc] init];
    IArray = [[NSMutableArray alloc] init];
    JArray = [[NSMutableArray alloc] init];
    KArray = [[NSMutableArray alloc] init];
    LArray = [[NSMutableArray alloc] init];
    MArray = [[NSMutableArray alloc] init];
    NArray = [[NSMutableArray alloc] init];
    OArray = [[NSMutableArray alloc] init];
    PArray = [[NSMutableArray alloc] init];
    QArray = [[NSMutableArray alloc] init];
    RArray = [[NSMutableArray alloc] init];
    SArray = [[NSMutableArray alloc] init];
    TArray = [[NSMutableArray alloc] init];
    UArray = [[NSMutableArray alloc] init];
    VArray = [[NSMutableArray alloc] init];
    WArray = [[NSMutableArray alloc] init];
    XArray = [[NSMutableArray alloc] init];
    YArray = [[NSMutableArray alloc] init];
    ZArray = [[NSMutableArray alloc] init];

and i have code to move each item from the database into the relevant array, this all works fine.

I then have this code:

All = [NSMutableDictionary dictionaryWithObjectsAndKeys:AArray,@"A",BArray,@"B",CArray,@"C",DArray,@"D",EArray,@"E",FArray,@"F",GArray,@"G",HArray,@"H",IArray,@"I",JArray,@"J",KArray,@"K",LArray,@"L",MArray,@"M",NArray,@"N",OArray,@"O",PArray,@"P",QArray,@"Q",RArray,@"R",SArray,@"S",TArray,@"T",UArray,@"U",VArray,@"V",WArray,@"W",XArray,@"X",YArray,@"Y",ZArray,@"Z",nil];
    AllArray = [NSArray alloc];
    AllArray = [AllArray initWithArray:[[All allKeys]sortedArrayUsingSelector:@selector(compare:)]];

and this

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    // Return the number of sections.
    return [AllArray count];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    NSArray *Array = [All objectForKey:[AllArray objectAtIndex:section]];
    return [Array count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    int sectionindex = section;
    return [AllArray objectAtIndex:sectionindex]; 

}

When i run it works fine, however if i scroll up and down a few times the app crashes without any error message.
It is something to do with the sections as it crashes when i add them in, but i just cannot see what im doing wrong

Everythings declared in the h file and i @property and @synthesize the following

@property (nonatomic,retain) NSMutableDictionary *All;
@property (nonatomic,retain) NSArray *AllArray;
@property (nonatomic, retain) UITableView *TableView;

If anyone could help me it would be really great!

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-23T11:12:29+00:00Added an answer on May 23, 2026 at 11:12 am

    Your dictionary “All” does not seem to be retained. You appear to assign the dictionary object directly to the instance variable, not to the property (in which case you would have used self.All).

    If your app crashes without a message, then make sure to enable the Breakpoints button in Xcode’s toolbar. This will run the app in the debugger, which will give you more helpful information about the crash. Setting NSZombieEnabled to YES also helps.

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

Sidebar

Related Questions

I have an app that must get data from the Sqlite database in order
I have a web-app-database 3 tier server setup. Web requests data from app, and
i have csv files, java app and database, i read csv file from my
I have an app that creates a SQLite database ( with 24 records ),
I have an app that needs to check a database table every minute. The
I am making an app that parses an RSS Feed into a SQLite database
I have an app that uses an sqlite database. Currently I have a database
We have a database app that we're beginning to write some new systems for
I have a web database app that runs in IE7+ (customer requirement) It is
I have a app that searches a database and retrieves 3 fields Name, Email

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.