title: Referencing superview's methods
body: <p>I'm making an application in Xcode, and running into some problems. I'm using the GameKit framework to allow for bluetooth communication between two iOS devices. The application is setup so that one of the devices is the "master" and the other is the "slave," changing it's screen content based on data received from the "master" device. The user can select whether to be the master or the slave, and when that choice is made, the other device automatically becomes the opposite role. This is all done in one view controller class. When a role is chosen, a subview is added to the baseViewController.</p>
  
  <p>What my problem is, is that when the subview that is added, I would like to be able to send data using the methods in the baseViewController class. With the current setup, the device invoking the action <code>becomeMaster:sender</code> crashes.</p>
  
  <p>What I've tried so far is,</p>
  
  <p>BaseViewController:</p>
  
  <pre><code>-(IBAction)becomeMaster:(id)sender {
      [self dataToSend:@"slave"]; //tells peer device to become slave, since this device is master
      masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
      [masterViewController setBaseViewController:self];
      [self.view addSubview:masterViewController.view];
  }
  
  -(void)dataToSend:(NSString *)direction {   
      //—-convert an NSString object to NSData—-  
      NSData* data;   
      NSString *str = [NSString stringWithString:direction];  
      data = [str dataUsingEncoding: NSASCIIStringEncoding];  
      [self mySendDataToPeers:data];
  }
  
  -(void)dataToSend:(NSString *)direction {   
      //—-convert an NSString object to NSData—-  
      NSData* data;   
      NSString *str = [NSString stringWithString:direction];  
      data = [str dataUsingEncoding: NSASCIIStringEncoding];  
      [self mySendDataToPeers:data];
  }
  
   //----------------------------------------------------------------------------//
  
  - (void)receiveData:(NSData *)data fromPeer:(NSString *)peer inSession:(GKSession *)session context:(void *)context {   
      //—-convert the NSData to NSString—-    
      NSString* str;  
      str = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
      [self useReceivedData:str];
      [str release];
  }
  
  -(void)useReceivedData:(NSString *)str {
      if ([str isEqualToString:@"forward"]) {
          [slaveViewController.view setBackgroundColor:[UIColor blackColor]];
      }
  }
  </code></pre>
  
  <p>MasterViewController:</p>
  
  <pre><code>-(void)setBaseViewController:(BaseViewController *)bvc {
      baseViewController = bvc;
  }
  
  -(IBAction)goForward:(id)sender {
      actionLabel.text = @"goingForward";
      [baseViewController dataToSend:@"forward"];
  }
  </code></pre>
  
  <p>Most of that code is part of the standard Apple documentation/examples, but I included it for understanding the flow of logic.</p>
  
  <p>I believe the problem originates to with the <code>becomeMaster:sender</code> and <code>setBaseViewController:bvc</code> methods. Could anyone help fix? Thanks so much!</p>