title: Access JSON file to populate UIPickerView
body: <p>There's a similar question to this on this site but being that I cannot add another comment on  that question in form of a question, I have chosen to write mine here, pardon me.Here goes,</p>
  
  <p>I have a JSON file on a local server and trying to access the values on my UIPickerView. The problem is I get a "question mark, i.e "?"  " instead of the strings on the JSON file. What's is the issue, how can i resolve this ? I'm still a beginner so go easy.</p>
  
  <p>Here is the code,</p>
  
  <pre><code>#import "ViewController.h"
  #import "JSON.h"
  
  @interface ViewController ()
  
  @end
  
  @implementation ViewController
  
  @synthesize picker;
  @synthesize terrainJsonArray;
  
  - (void)viewDidLoad
  {
  [super viewDidLoad];
  
  NSString *terrainString = [NSString stringWithFormat:@"http://terrainracing.com/ios/events_json.php"];
  
  NSURL *terrainUrl = [NSURL URLWithString:terrainString];
  
  NSData  *terrainData = [NSData  dataWithContentsOfURL:terrainUrl];
  
  NSError *error;
  
  self.terrainJsonArray = [NSJSONSerialization JSONObjectWithData:terrainData options:kNilOptions error:&amp;error];
  
  NSLog(@"%@", terrainJsonArray);
  
  }
  
  - (void)didReceiveMemoryWarning
  {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
  }
  
  - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
  {
  return 1;
  }
  
  - (NSInteger)pickerView:(UIPickerView *)pickerView
   numberOfRowsInComponent:(NSInteger)component {
  return self.terrainJsonArray.count;
  }
  
  #pragma mark Picker Delegate Methods
  - (UIView *)pickerView:(UIPickerView *)pickerView
           titleForRow:(NSInteger)row
  {
  
  return [self.terrainJsonArray objectAtIndex:row];
  
  }
  @end
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/pZQJT.png" alt="enter image description here"></p>