title: How to get an array out of Grand Central Dispatch?
body: <p>I am a newbie. I am using Grand Central Dispatch to populate an array (student_temp) on another thread. That part is working fine.  The problem is I cannot pass the array to a class property (student_Array) where it is used throughout the class. I can't get the array back on the main thread. </p>
  
  <p>it works fine until I get back tot he main thread and I can't pass student_temp into student_Array (the property) either inside or outside of GCD.</p>
  
  <p>What am I doing wrong, or is there a better to populate the array property using GCD?</p>
  
  <p>Thank you for your help. And please try to explain in non-technical language if possible I am new at this.</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      R2LFetcher *studentFetch = [[R2LFetcher alloc] init];
      __block NSMutableArray *student_temp = [[NSMutableArray alloc] init];
  
      dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
      dispatch_async(queue, ^{
  
          //long-running code goes here…
             student_temp  = [studentFetch fetchToStudentArray];
  
          dispatch_async(dispatch_get_main_queue(), ^{
  
              // code the updates the main thread (UI) here...
              student_Array = student_temp;
  
          });
  
      });
      student_Array = student_temp;
  </code></pre>