Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Objects in NSMutableArray inaccesible Objective-C
- + (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;
- }
- + (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;
- }
Add Comment
Please, Sign In to add comment