title: Sending data from NSObject to UIViewController
body: <p>I have been working on this problem for close to 4 days now. </p>
  
  <p>I am at the point where I think its not so much a problem with my code, but the structure of my application that is causing the issue.</p>
  
  <p>I am trying to implement protocols and delegates to get an array from one NSObject(class) to a ViewController.</p>
  
  <p>my code is pretty much line by line copied from this <a href="http://www.ios-developer.net/iphone-ipad-programmer/development/delegates/how-to-create-a-delegate" rel="nofollow">tutorial</a> the only differences are in the face I have ARC turned on so have had to replace (nonatomic, retain) to (strong) and have not used dealloc :)</p>
  
  <p>so with that being said its still not passing the data back to the viewcontroller. (highly annoying) I have tried dozens of different combinations of solutions that I have had help with and nothing has worked. This has lead me to believe that maybe there is an error in the structure of my application or the way things have been initialized etc, which I will attempt to explain now.</p>
  
  <p>When my viewcontroller with tableview loads the viewdidload method called the delegate of my  parser class, then once the first cell of the tableview has loaded it called my connection class and tells it to download some data from the server.
  Inside my connection class I use NSURLConnection delegates from the apple library, in the delegate method connectionDidFinishLoading the data that has been downloaded is passed over to my parser class (however this is where i think its going wrong because i declare the object again.. which i think is where things are going amiss)</p>
  
  <p>this is how I call my parser class from my connection class.</p>
  
  <pre><code>parserClass *myparser = [[EngineResponses alloc] init];
  [myparser  ReciveResponse:receivedData];
  </code></pre>
  
  <p>then once the data is in my parser class it gets parsed and then I try to pass the data across to my viewcontroller.. but its never accessing that delegate method that I set up.</p>
  
  <p>Hopefully this is where the problem is because I just dont know where else I am going wrong.
  what do you think?</p>
  
  <p>UPDATE: heres my code -</p>
  
  <p><strong>ViewController.h</strong></p>
  
  <pre><code>#import "EngineResponses.h" //delegates &amp; protocols
  
  interface SearchViewController : UITableViewController &lt;PassParsedData&gt; {
  
  //delegates to parser class
      EngineResponses *engineResponses;
  //..
  </code></pre>
  
  <p><strong>ViewController.m</strong></p>
  
  <pre><code>#import "EngineResponses.h"
  
  //this is where I set up the delegate/protocol for the parser class
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  
  //..
  engineResponses = [[EngineResponses alloc] init];
  [engineResponses setMydelegate:self];
  //..
  }
  
  //this is where i set up and call the connection class
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  //..
  if(indexPath.section == 0){        
      //..
      if (indexPath.row == 0){
       EngineRequests *engineRequests = [[EngineRequests alloc] init];
                  [engineRequests initalizePacketVariables:0 startCode:@"myReg" activationCode:@"myAct" methodName:@"GetStuff"];
                  //..
  }
  
  #pragma - Reciver methods
  
  - (void)sendArray:(NSArray *)array
  {
      ICMfgFilterArray = array;
      [self.tableView reloadData]; 
  }
  </code></pre>
  
  <p><strong>EngineRequests.m</strong></p>
  
  <pre><code>//connection delegates etc..
  //then I pass the data from the connection delegates over to the parser class
  - (void)connectionDidFinishLoading:(NSURLConnection *)connection
  {   
      EngineResponses *engineResponses = [[EngineResponses alloc] init];
      [engineResponses  ReciveResponse:receivedData];
  }
  </code></pre>
  
  <p><strong>EngineResponses.h</strong></p>
  
  <pre><code>@protocol PassParsedData
  - (void)sendArray:(NSArray *)array;
  @end
  
  //..
  id &lt;PassParsedData&gt; mydelegate;
  //..
  @property (strong) id  &lt;PassParsedData&gt; mydelegate; 
  </code></pre>
  
  <p><strong>EngineResponses.m</strong></p>
  
  <pre><code>- (void)parserDidEndDocument:(NSXMLParser *)parser
  {
  //..
      [[self mydelegate]sendArray:filteredArray];    
  }
  </code></pre>
  
  <p>1</p>