0

I am trying to display data from a parse table. The class name is Account and the column I want to retrieve data from is called name. I keep getting an error of property name not found on object of type NSArray. I understand that you cannot pass a NSArray to an NSString but how do i display this data correctly. Any help would be great.

Here is my code that does not work:

- (void)viewDidLoad
{
    [super viewDidLoad];
    PFQuery *query = [PFQuery queryWithClassName:@"Account"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        self.test.text = objects.name;

    }];

}
0

1 Answer 1

2

Here is what you want to do (this is just going to display 'name' for the first object in the array):

PFQuery *query = [PFQuery queryWithClassName:@"Account"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        self.test.text = [[objects objectAtIndex:0] objectForKey:@"name"];

    }];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.