daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Objects in NSMutableArray inaccesible Objective-C
  2. + (NSMutableArray*) list
  3. {
  4.  
  5.     NSString *querySQL = //some query;
  6.  
  7.     NSMutableArray *values = [Client displayQuery:querySQL numberOfColumns:7];
  8.  
  9.     NSMutableArray *lst = nil;
  10.  
  11.     if (values != nil)
  12.     {
  13.         lst = [NSMutableArray arrayWithObject:@"Client"];
  14.  
  15.         for (int i = 0; i<[[values objectAtIndex:0] count] ; i++)
  16.         {    
  17.             [lst addObject:[Client new ]];
  18.         }
  19.         for (int i = 0; i<[[values objectAtIndex:0] count] ; i++)
  20.         {    
  21.  
  22.             Client *aClient = [lst objectAtIndex:i];
  23.             //error occurs during the execution of this line.
  24.             //all properties of Class client are (retain,nonatomic)
  25.             aClient.idClient = [[values objectAtIndex:0]objectAtIndex:i];
  26.             aClient.prenom = [[values objectAtIndex:1]objectAtIndex:i];
  27.             aClient.name = [[values objectAtIndex:2]objectAtIndex:i];
  28.             aClient.address = [[values objectAtIndex:3]objectAtIndex:i];
  29.             aClient.telephone = [[values objectAtIndex:4]objectAtIndex:i];
  30.             aClient.email = [[values objectAtIndex:5]objectAtIndex:i];
  31.             aClient.weight = [[values objectAtIndex:6]objectAtIndex:i];
  32.             [lst addObject: aClient];
  33.  
  34.         }
  35.     }
  36.     return lst;
  37. }
  38.    
  39. + (NSMutableArray*) list
  40. {
  41.     NSString *querySQL = //some query;
  42.     NSMutableArray *columns = [Client displayQuery:querySQL numberOfColumns:7];
  43.     NSMutableArray *lst = nil;
  44.  
  45.     if (columns == nil)
  46.         return nil;
  47.  
  48.     NSUInteger count = [[columns objectAtIndex:0] count];
  49.     lst = [NSMutableArray arrayWithCapacity:count];
  50.  
  51.     for (NSUInteger row = 0; row < count; row++)
  52.     {    
  53.         Client *aClient = [Client new];
  54.  
  55.         aClient.idClient = [[columns objectAtIndex:0] objectAtIndex:row];
  56.         aClient.prenom = [[columns objectAtIndex:1] objectAtIndex:row];
  57.         aClient.name = [[columns objectAtIndex:2] objectAtIndex:row];
  58.         aClient.address = [[columns objectAtIndex:3] objectAtIndex:row];
  59.         aClient.telephone = [[columns objectAtIndex:4] objectAtIndex:row];
  60.         aClient.email = [[columns objectAtIndex:5] objectAtIndex:row];
  61.         aClient.weight = [[columns objectAtIndex:6] objectAtIndex:row];
  62.  
  63.         [lst addObject: aClient];
  64.     }
  65.  
  66.     return lst;
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top