title: Multipeer Connectivity: getting an invitation accepted (using built-in browser VC)
body: <p>I'm trying to <a href="https://developer.apple.com/wwdc/videos/index.php?id=708" rel="noreferrer">follow the WWDC talk</a> to learn about the MultipeerConnectivity framework. After many false starts, the browser(s) show the peers, and invitations get issued.</p>
  
  <p>But when I press "Accept" on the peer device, the browser keeps showing "Connecting" without end. I thought that the <code>MCBrowserViewController</code> took care of the logic and I could relax until the browser's user pressed Cancel or Done, and the delegate method fired. I bet it's something obvious, but it's eluding me. </p>
  
  <p>Here's what I hope is the relevant code. I have it in the AppDelegate. NSLog statements in the various delegate methods get called as I would expect—except for the one in <code>browserViewControllerDidFinish:</code> of course.</p>
  
  <p>Bear in mind that the browser and invitations do appear, so <em>something</em> is right!</p>
  
  <p>In the @interface...</p>
  
  <pre><code>@property   (strong, nonatomic) MCSession   *theSession;
  @property   (strong, nonatomic) MCAdvertiserAssistant       *assistant;
  @property   (strong, nonatomic) MCBrowserViewController     *browserVC;
  </code></pre>
  
  <p>In the @implementation</p>
  
  <pre><code>static    NSString* const    kServiceType = @"eeps-multi";
  
  // called from viewDidAppear in the main ViewController
  
  -(void)     startSession
  {
      if (!self.theSession) {
          UIDevice *thisDevice = [UIDevice currentDevice];
  
          MCPeerID *aPeerID = [[ MCPeerID alloc ] initWithDisplayName: thisDevice.name];
          self.theSession = [[ MCSession alloc ] initWithPeer: aPeerID ];
          self.theSession.delegate = self;
      } else {
          NSLog(@"Session init skipped -- already exists");
      }
  }
  
  // called from viewDidAppear in the main ViewController
  
  - (void)    startAdvertising
      {
      if (!self.assistant) {
          self.assistant = [[MCAdvertiserAssistant alloc] initWithServiceType:kServiceType
                                                                discoveryInfo:nil
                                                                      session:self.theSession ];
          self.assistant.delegate = self;
          [ self.assistant start ];
      } else {
          NSLog(@"Advertiser init skipped -- already exists");
      }
  }
  
  // called from the main ViewController in response to a button press
  
  - (void)    startBrowsing
  {
      if (!self.browserVC){
          self.browserVC = [[MCBrowserViewController alloc] initWithServiceType:kServiceType 
                                                                        session:self.theSession];
          self.browserVC.delegate = self;
      } else {
          NSLog(@"Browser VC init skipped -- already exists");
      }
  
      [ self.window.rootViewController presentViewController:self.browserVC animated:YES completion:nil];
  }
  </code></pre>
  
  <p>Thanks in advance!</p>