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 7863931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:38:05+00:00 2026-06-02T23:38:05+00:00

SO here’s my setup. I have an object called radiostations where I have several

  • 0

SO here’s my setup. I have an object called radiostations where I have several strings like callsign, frequency declared and an NSMutableArray called amStationInfo. On my viewcontroller, I access an SQLite database which populates the an array like so…

radiostations.h

@interface radiostations : NSObject {

    NSString *format;
    NSString *city;
}

@property (nonatomic, retain) NSString *format;
@property (nonatomic, retain) NSString *city;

ViewController.m

radiostations *amStationClass = [[radiostations alloc] init];
NSMutableArray* amStationInfo = [[NSMutableArray alloc] init];

while (sqlite3_step(statement) == SQLITE_ROW)
    {
    NSString *cityField = [[NSString alloc] initWithUTF8String:
                                   (const char *) sqlite3_column_text(statement, 10)];
    NSString *formatField = [[NSString alloc] initWithUTF8String:
                                    (const char *) sqlite3_column_text(statement, 0)];
    [amStationInfo addObject:amStationClass];
                    [amStationClass setCity:cityField];
                    [amStationClass setFormat:formatField];
    }
[tabView reloadData];
sqlite3_finalize(statement);

and then I populate a UITableView

NSString *cityValue = [(radiostations *)[amStationInfo objectAtIndex:indexPath.row] city];
NSString *formatValue = [(radiostations *)[amStationInfo objectAtIndex:indexPath.row] format];
cityLabel.text = cityValue;
formatLabel.text = formatValue;

Initially I was dealing with a few Arrays and this worked just fine. I then changed it so that I was only dealing with one array using a class object and now it’s not working. I know the SQLite query and what not works so Im not having any problems with that. It seems as though the array does not get populated.

  • 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-06-02T23:38:07+00:00Added an answer on June 2, 2026 at 11:38 pm

    You are changing the properties of the same radiostations object and adding it over and over again to the array. You need to create a new radiostations object for each row from your sqlite database and add this:

    while (...) {
        // fetch data as before
    
        radiostations *record = [[radiostations alloc] init];
        [record setCity: cityField];
        [record setFormat: formatField];
        [amStationInfo addObject: record];
        [record release];
    }
    

    If you are using ARC you need to remove the line [record release];, otherwise it is necessary to avoid leaking those objects.

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

Sidebar

Related Questions

Here's the basic setup: I have a thin bar at the top of a
Here is an example: I have the generic type called Account. I wish to
Here I have an int x=3; NSLog(@%i, x); How to have it displayed like
Here's a problem I ran into recently. I have attributes strings of the form
Here is my problem...I have a page that loads a list of clients and
Here is an example: I have a file 1.js, which has some functions. I
Here is my situation: I am using telerik with winform. I have a dataset
Here is my problem : I have a post controller with the action create.
Here is my code...I have two dimensional matrices A,B. I want to develop the
here's what we have today: * NxM grid of points in 3D * we

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.