Multipeer Connectivity: uzyskanie zaproszenia zaakceptowanego (przy użyciu wbudowanej przeglądarki VC)

Próbujępostępuj zgodnie z rozmową WWDC aby dowiedzieć się więcej o platformie MultipeerConnectivity. Po wielu fałszywych uruchomieniach przeglądarka (-y) pokazuje rówieśnikom, a zaproszenia są wydawane.

Ale kiedy nacisnę „Akceptuj” na urządzeniu równorzędnym, przeglądarka bez końca wyświetla „Łączenie”. Myślałem, żeMCBrowserViewController zadbałem o logikę i mogłem się zrelaksować, aż użytkownik przeglądarki wcisnął Anuluj lub Gotowe, a metoda delegata została uruchomiona. Założę się, że to coś oczywistego, ale mi się wymyka.

Oto, co mam nadzieję, to odpowiedni kod. Mam go w AppDelegate. Instrukcje NSLog w różnych metodach delegowania są wywoływane tak, jak powinienem - z wyjątkiem tego wbrowserViewControllerDidFinish: oczywiście.

Pamiętaj, że przeglądarka i zaproszenia pojawiają się, więccoś jest w porządku!

W @interface ...

@property   (strong, nonatomic) MCSession   *theSession;
@property   (strong, nonatomic) MCAdvertiserAssistant       *assistant;
@property   (strong, nonatomic) MCBrowserViewController     *browserVC;

W @implementacji

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];
}

Z góry dziękuję!

questionAnswers(3)

yourAnswerToTheQuestion