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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:46:45+00:00 2026-05-27T11:46:45+00:00

//ARC is turned on in Xcode 4.2 A static function is created which executes

  • 0

//ARC is turned on in Xcode 4.2

A static function is created which executes a query and gets the values from the database SQLite.
The array values returned by the function displayquery is an array of a no of mutable arrays which contain the records.
I want to convert it into client objects and store the list list in an NSMutable object before returning it.

static function

+ (NSMutableArray*) list
{

    NSString *querySQL = //some query;

    NSMutableArray *values = [Client displayQuery:querySQL numberOfColumns:7];

    NSMutableArray *lst = nil;

    if (values != nil)
    {
        lst = [NSMutableArray arrayWithObject:@"Client"];

        for (int i = 0; i<[[values objectAtIndex:0] count] ; i++) 
        {    
            [lst addObject:[Client new ]];
        }
        for (int i = 0; i<[[values objectAtIndex:0] count] ; i++) 
        {    

            Client *aClient = [lst objectAtIndex:i];
            //error occurs during the execution of this line.
            //all properties of Class client are (retain,nonatomic)
            aClient.idClient = [[values objectAtIndex:0]objectAtIndex:i];
            aClient.prenom = [[values objectAtIndex:1]objectAtIndex:i];
            aClient.name = [[values objectAtIndex:2]objectAtIndex:i];
            aClient.address = [[values objectAtIndex:3]objectAtIndex:i];
            aClient.telephone = [[values objectAtIndex:4]objectAtIndex:i];
            aClient.email = [[values objectAtIndex:5]objectAtIndex:i];
            aClient.weight = [[values objectAtIndex:6]objectAtIndex:i];
            [lst addObject: aClient];

        }
    }
    return lst;
}
  • 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-27T11:46:46+00:00Added an answer on May 27, 2026 at 11:46 am

    The problem is that the first element in your lst array is an NSString, which does not have any of the properties that your Client class has, and when you try to assign to it, you get an error. There are a few issues in your code:

    1. Don’t add @"Client" as an element in your array, since it doesn’t seem like it belongs there.
    2. You don’t need to “pre-add” the Client objects to the array. Just create them and add them to the array as you go.
    3. When you have arrays of arrays, it can become harder to understand what each index is for when you look up items. I’ve renamed a couple of variables in your code because it made it easier for me to understand.

    I think your code should look more like this:

    + (NSMutableArray*) list
    {
        NSString *querySQL = //some query;
        NSMutableArray *columns = [Client displayQuery:querySQL numberOfColumns:7];
        NSMutableArray *lst = nil;
    
        if (columns == nil)
            return nil;
    
        NSUInteger count = [[columns objectAtIndex:0] count];
        lst = [NSMutableArray arrayWithCapacity:count];
    
        for (NSUInteger row = 0; row < count; row++) 
        {    
            Client *aClient = [Client new];
    
            aClient.idClient = [[columns objectAtIndex:0] objectAtIndex:row];
            aClient.prenom = [[columns objectAtIndex:1] objectAtIndex:row];
            aClient.name = [[columns objectAtIndex:2] objectAtIndex:row];
            aClient.address = [[columns objectAtIndex:3] objectAtIndex:row];
            aClient.telephone = [[columns objectAtIndex:4] objectAtIndex:row];
            aClient.email = [[columns objectAtIndex:5] objectAtIndex:row];
            aClient.weight = [[columns objectAtIndex:6] objectAtIndex:row];
    
            [lst addObject: aClient];
        }
    
        return lst;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My project is created with ARC turned on, now I am using a third
UPDATE This is an old question for an old version of Xcode. It turned
I've created an ARC Application that run's perfect. It's got a UINavigationController that I
With ARC enabled, shouldn't the Preprocessor insert retain/release/autorelease calls? When I let Xcode generate
Looking at this code (ARC turned on): -(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { dispatch_queue_t fetchDataQueue
Using ARC... NSArray *array = [NSArray arrayWithObjects:@dog, @cat, @mouse, nil]; for(NSString *animal in array)
With all this new ARC stuff (which does not fall under NDA…) coming out,
I created a project without ARC . I want to use a third party
I have an iOS-App which uses ARC. I don't use InterfaceBuilder, all UI is
My app, which uses ARC, does the following: Uploads a picture taken by the

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.