0

アプリケーションでは、invitationDidFail が呼び出され、正しく接続される場合もありますが、接続されない場合もあります...

接続を拒否する理由として考えられるものは何ですか?

// Display an alert sheet indicating a failure to connect to the peer.
- (void) invitationDidFail:(SessionManager *)session fromPeer:(NSString *)participantID
{
NSString *str;
if (alertView.visible) {
    // Peer cancelled invitation before it could be accepted/rejected
    // Close the invitation dialog before opening an error dialog
    [alertView dismissWithClickedButtonIndex:0 animated:NO];
    [alertView release];
    str = [NSString stringWithFormat:@"%@ is busy.\nPlease again", participantID];
    //[peerList removeAllObjects];
    [self peerListDidChange:nil];
    [self.tableData reloadData];
    //[self TwoPlayer:self];
} else {
    // Peer rejected invitation or exited app.
    str = [NSString stringWithFormat:@"%@ is busy.\nPlease try again", participantID];
    //[peerList removeAllObjects];
    [self peerListDidChange:nil];
    [self.tableData reloadData];
    //[self TwoPlayer:self];
  }
}

このメソッドを呼び出さなくても、デバイスが他のデバイスとペアリングされていないことは確かですが、それを受け入れて didReceivedInvitation メソッドを呼び出したり、invitationDidFail を呼び出して拒否したりする理由は何ですか。

// Invitation dialog due to peer attempting to connect.
- (void) didReceiveInvitation:(SessionManager *)session fromPeer:(NSString     *)participantID;
{
[alertView dismissWithClickedButtonIndex:1 animated:NO];

NSString *str = [NSString stringWithFormat:@"Incoming Invite from %@", participantID];
if (alertView.visible) {
    [alertView dismissWithClickedButtonIndex:0 animated:NO];
    [alertView release];
}
alertView = [[UIAlertView alloc] 
             initWithTitle:str
             message:@"Do you wish to accept?" 
             delegate:self 
             cancelButtonTitle:@"Decline" 
             otherButtonTitles:nil];
[alertView addButtonWithTitle:@"Accept"]; 
[alertView show];
}
4

1 に答える 1