You can get the array of strings in a single step using Key-Value Coding (KVC)
,
self.colorArray = [objects valueForKeyPath:@"local"];
You should have a look on Key-Value Coding Programming Guide
Question
This supposed to be a simple thing to do, but i`m having a hard time to find this answer.
X-Code / Objective-C:
I have an sheet stored at Parse.com, and I simply want to make a array with one of its columns. For example, I have a spread sheet called Places and I want to build an Array of the column Address of these places, but instead I`m getting an Array of objects. Look!
PFQuery *query = [PFQuery queryWithClassName:@"Locais"];
[query selectKeys:@[@"local"]];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
self.colorArray = [NSArray arrayWithObject:objects];
NSLog(@"%@", objects);
}];
The log:
"<Locais:fEQq2qB8dJ:(null)> {\n local = \"Giga CCM/CCS\";\n}",
"<Locais:z3gHNJ7CPw:(null)> {\n local = \"Giga Santander\";\n}",
"<Locais:rNEJUHPXtl:(null)> {\n local = \"Sean Plott\";\n}"
How I want to get the log:
"Giga ccm/css" "Giga santander" "Sean Plott"
La solution
You can get the array of strings in a single step using Key-Value Coding (KVC)
,
self.colorArray = [objects valueForKeyPath:@"local"];
You should have a look on Key-Value Coding Programming Guide
Autres conseils
You can extract the data from the array like this :
PFObject *localis = objects[1];
NSString *string = [localis objectForKey:@"local"];
This is how you can get the data out of it.