title: Still confused by Objective C variable scope
body: <p>I am trying to get some employee data from a JSON service. I am able to get the data and load it into an NSMutableArray, but I cannot access that array outside the scope of the method that gets the data.</p>
  
  <p>TableViewController h filed</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "employee.h"
  
  @interface ViewController : UITableViewController
  
  {
      //NSString *test;
      //NSMutableArray *employees;
  }
  
  @end
  </code></pre>
  
  <p>And here is my m file:</p>
  
  <pre><code>#define kBgQueue dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
  #define scoularDirectoryURL [NSURL URLWithString: @"https://xxxx"]
  
  #import "ViewController.h"
  
  @interface ViewController()
  
  @end
  
  @implementation ViewController
  
  - (void)viewDidLoad {
  
      [super viewDidLoad];
  
      dispatch_async(kBgQueue, ^{
  
          NSData* data = [NSData dataWithContentsOfURL:
                          scoularDirectoryURL];
  
          [self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES];
      });
  }
  
  
  - (void)fetchedData:(NSData *)responseData {
  
      NSError* error;
      NSMutableArray *jsonArray = [NSJSONSerialization JSONObjectWithData: responseData options: NSJSONReadingMutableContainers error: &amp;error];
      id jsonObject = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&amp;error];
  
      NSMutableArray *employees = [[NSMutableArray alloc  ]init];
      if (!jsonArray) {
  
      } else {
  
          for (jsonObject in jsonArray){
              employee *thisEmployee  = [employee new];
              thisEmployee.fullName   = [jsonObject objectForKey:@"$13"];
              thisEmployee.state      = [jsonObject objectForKey:@"state"];
              thisEmployee.city       = [jsonObject objectForKey:@"city"];
              [employees addObject:thisEmployee];
          }
      }
  }
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p>Bryan</p>