Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble getting parsed array in tableView iOS
    primarykey
    data
    text
    <p>How can I make sure that a query is finished (whether successful or not) before performing another task.</p> <p>Here is my viewDidLoad...this line of code at the end</p> <pre><code> NSLog(@"tweets Array %@",self.tweetsArray); </code></pre> <p>Is showing that tweetsArray is empty</p> <p>Yet the same line of code in the block above it shows the Array to be full. </p> <p>The Output also shows the last NSLog before the first. </p> <p>My tableView is blank on the simulator because it is calling the UITableView methods before it has finished running query.</p> <p>Any help on this would be great.</p> <p>Thanks in Advance... Nick</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.tableView.dataSource = self; self.tableView.delegate = self; self.selectString = self.gamesString; PFQuery *query = [PFQuery queryWithClassName:@"Parse_Storyw"]; [query whereKey:@"searchName" equalTo:self.gamesString]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error) { // Do something with the found objects for (PFObject *object in objects) { NSLog(@"%@", object.objectId); PFQuery *query = [PFQuery queryWithClassName:@"Parse_Story"]; [query getObjectInBackgroundWithId:object.objectId block:^(PFObject *content, NSError *error) { PFFile *file = [content objectForKey:@"levels"]; [file saveInBackground]; [file getDataInBackgroundWithBlock:^(NSData *data, NSError *error) { NSString *string = [[NSString alloc] initWithData: data encoding: NSMacOSRomanStringEncoding]; self.tweetsArray = [[NSArray alloc] initWithArray:[string componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]]; NSLog(@"tweets Array %@",self.tweetsArray); }]; }]; } } else { // Log details of the failure NSLog(@"Error: %@ %@", error, [error userInfo]); } }]; self.title = self.selectString; NSLog(@"tweets Array %@",self.tweetsArray); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload