I'm trying to use the parse.com data browser to inset a new string array into my code.
So if I've got a code with an array of @"blue", @"yellow", @"black", nil then how can I change it to @"white", @"gold", @"brown", nil ?
In the app, I have the user press a button and one of said string value appears at random. I would like to put a new array on a backend to have new values so that I don't have to update the app every time.
Is there an example of how to do this? I haven't been able to get the Data Browser to replace the array in my code with the array in the data browser.
I've got:
PFQuery *query = [PFQuery queryWithClassName:@"colorArray"];
self.colors = [query findObjects];
But it crashes when I try to retrieve the values of the array when it gets to this part of the code in a later method -
NSUInteger index = arc4random_uniform(self.colors.count];
self.colorLabel.text = [self.colors objectAtIndex:index];
self.colors, by the way, is synthesized from the header file as an array. It looks like the code doesn't understand the "index" part of the equation when it tries to set the self.colorLabel.text using the obectAtIndex
The crash is "-[PFObject length]: unrecognized selector sent to instance 0xcb56740".
Am I doing this right?
self.colors, and does that code actually compile? Or is that a typo?PFQuery?findObjectsreturns an array ofPFObjectinstances. You can't assign those to anNSStringproperty. What property of thePFObjectare you trying to access? EDIT: also, this looks like two questions in one, am I wrong? "How to replace a an array stored on parse", and "how to put the color name into a label".