title: how is the code for pickerview showing parsed url response into the pickerview?
body: <p>I have implemented below code displaying the response data in <code>UIPickerView</code>. it crashed when I run the application. How to solve the problem?</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
  
      self.view.frame=CGRectMake(0, 0, 320, 480);
      materialarray = [[NSMutableArray alloc] init];
  
  
  
      [picbutton setTitle:[materialarray objectAtIndex:0] forState:UIControlStateNormal];
      [self testing];
          }
  
  -(IBAction)picbuttonaction:(id)sender{
  
      NSLog(@"unitpiker");
      [enterVal1 resignFirstResponder];
      [enterVal2 resignFirstResponder];
  
  
      str = picbutton.currentTitle;   
      UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:nil 
                                                        delegate:self
                                               cancelButtonTitle:@"Done"
                                          destructiveButtonTitle:nil
                                               otherButtonTitles:nil];
  
  
      Picker = [[UIPickerView alloc] init];
      Picker.tag = 1;
      Picker.showsSelectionIndicator = YES;
      Picker.dataSource = self;
      Picker.delegate = self;
  
      [Picker  selectRow:j inComponent:0 animated:YES];
      [menu addSubview:Picker];
      [menu showInView:self.view];   
      [menu sendSubviewToBack:Picker];     
      [menu setBounds:CGRectMake(0,0,320, 300)];
  
      CGRect pickerRect = Picker.bounds;
      Picker.bounds = pickerRect;
  
      [Picker release];
      [menu release];
  }
  - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
  {
      if (pickerView.tag==1) {
          return 1;
      }
      if(pickerView.tag==2){
          return 1;
      }
      return 0;
  }
  -(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
  {
      if (pickerView.tag==1){ 
  
          return [materialarray count];
      }
      if(pickerView.tag==2){
          return [array_preferences count];
      }
      return 0;
  }
  - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
  {
      if (pickerView.tag==1) {
  
          return [materialarray objectAtIndex:row];
      }
      if(pickerView.tag==2){
          return [array_preferences objectAtIndex:row];
      }
      return 0;
  }   
  - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;
  {
      j=row;
  
      [picbutton setTitle:[materialarray objectAtIndex:row] forState:UIControlStateNormal];   
      }       
  
  -(IBAction)Resetbuttonaction{
  
      [picbutton setTitle:[materialarray objectAtIndex:0] forState:UIControlStateNormal];
      j=0;
  }
  
  
  -(void)testing{
      NSString *jobSearchUrlString = [NSString stringWithFormat:@"http://infra2appsmobile.cloudapp.net/Infra2Apps.svc/Contacts"];
      //NSLog(@"url for new articles is = %@",jobSearchUrlString);
      NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:jobSearchUrlString]];   
  
      NSURLConnection *theconnection =  [[NSURLConnection alloc] initWithRequest:request delegate:self];
      if (theconnection) {
          RoutData = [[NSMutableData alloc] init];
      }
  
  }
  -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
  {   
  
      [RoutData setLength: 0];
  }
  -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
  {
      [RoutData appendData:data]; 
  
      NSString *thexml = [[NSString alloc] initWithData:RoutData encoding:NSUTF8StringEncoding];
  
      NSDictionary *dictXML= [XMLReader dictionaryForXMLString:thexml error:nil];
  
      NSMutableArray *arrStation = [[dictXML objectForKey:@"feed"] objectForKey:@"entry"] ;//this would   
  
  
  
      for (int i=0; i&lt;[arrStation count]; i++){
          str=[[[[[arrStation objectAtIndex:i] objectForKey:@"content"]   objectForKey:@"m:properties"] objectForKey:@"d:ContactName"] objectForKey:@"text"];
          //  NSlog(@"name is : %@",str);
  
          [materialarray addObject:str];
          [Picker reloadAllComponents];
          NSLog(@"name is-&gt;&gt;&gt;&gt;&gt;&gt;&gt; : %@",materialarray);        
      }
  
      /
  
  
  }
  </code></pre>
  
  <p>When I run the application it shows: </p>
  
  <pre><code>2012-03-03 12:09:55.665 AdditionNumbers[1698:f803] Could not load the "dropdown2.png" image referenced from a nib in the bundle with identifier "com.yourcompany.AdditionNumbers"
  2012-03-03 12:09:55.909 AdditionNumbers[1698:f803] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
  *** First throw call stack:
  (0x14d1052 0x11bcd0a 0x14bddb8 0x2f0f 0x43064e 0x2abc 0x3689d6 0x3698a6 0x378743 0x3791f8 0x36caa9 0x1bc7fa9 0x14a51c5 0x140a022 0x140890a 0x1407db4 0x1407ccb 0x3692a7 0x36aa9b 0x2a2d 0x29a5)
  terminate called throwing an exceptionCurrent  
  </code></pre>
  
  <p>I am getting response like below I have to show al those data into the pickerview how it is possible?</p>
  
  <pre><code>name is-&gt;&gt;&gt;&gt;&gt;&gt;&gt; : (
      "\n        Enrico Gaetani",
      "\n        J\U00e9r\U00f4me Tredan"
  )
  2012-03-03 12:01:27.865 UIPickerView[1654:f803] name is-&gt;&gt;&gt;&gt;&gt;&gt;&gt; : (
      "\n        Enrico Gaetani",
      "\n        J\U00e9r\U00f4me Tredan",
      "\n        Mike Tsalidis"
  )
  2012-03-03 12:01:27.865 UIPickerView[1654:f803] name is-&gt;&gt;&gt;&gt;&gt;&gt;&gt; : (
      "\n        Enrico Gaetani",
      "\n        J\U00e9r\U00f4me Tredan",
      "\n        Mike Tsalidis",
      "\n        Dana Sugarman"
  )
  2012-03-03 12:01:27.866 UIPickerView[1654:f803] name is-&gt;&gt;&gt;&gt;&gt;&gt;&gt; : (
      "\n        Enrico Gaetani",
      "\n        J\U00e9r\U00f4me Tredan",
      "\n        Mike Tsalidis",
      "\n        Dana Sugarman",
      "\n        Necip Ozyucel"
  )
  2012-03-03 12:01:27.867 UIPickerView[1654:f803] name is-&gt;&gt;&gt;&gt;&gt;&gt;&gt; : (
      "\n        Enrico Gaetani",
      "\n        J\U00e9r\U00f4me Tredan",
      "\n        Mike Tsalidis",
      "\n        Dana Sugarman",
      "\n        Necip Ozyucel",
      "\n        Goksel Topbas"
  )
  2012-03-03 12:01:27.868 UIPickerView[1654:f803] name is-&gt;&gt;&gt;&gt;&gt;&gt;&gt; : (
      "\n        Enrico Gaetani",
      "\n        J\U00e9r\U00f4me Tredan",
      "\n        Mike Tsalidis",
      "\n        Dana Sugarman",
      "\n        Necip Ozyucel",
      "\n        Goksel Topbas",
      "\n        Nizar Abdul-Baki"
  )
  2012-03-03 12:01:27.951 UIPickerView[1654:f803] name is-&gt;&gt;&gt;&gt;&gt;&gt;&gt; : (
      "\n        Enrico Gaetani",
      "\n        J\U00e9r\U00f4me Tredan",
      "\n        Mike Tsalidis",
      "\n        Dana Sugarman",
      "\n        Necip Ozyucel",
      "\n        Goksel Topbas",
      "\n        Nizar Abdul-Baki",
      "\n        Johannes Kanis"
  )
  </code></pre>