Protocol: GKVoiceChatClient

Overview

The GKVoiceChatClient protocol is implemented to control the behavior of the GKVoiceChatService object. The voice chat client has a number of responsibilities:Returns a string that uniquely identifies the local user. (required)Received by the client when an attempt to establish a voice chat with another participant failed.Asks the client to accept or reject an invitation from a remote participant.Received by the client when a voice chat with another participant is established.Received by the client when a previously established voice chat has ended.A request for the client to send data to a participant. (required)Asks the client to send data to a participant that must get there quickly.

Instance Method Summary (collapse)

Instance Method Details

- (String) participantID

Returns a string that uniquely identifies the local user. (required) The client decides the format and meaning of the participant identifier. For more information, see the Game Center Programming Guide.

Returns:

  • (String)

    A string that can be used by other participants to connect to the local user.

- (Object) voiceChatService(voiceChatService, didNotStartWithParticipantID:participantID, error:error)

Received by the client when an attempt to establish a voice chat with another participant failed. Your application can implement this method to notify the user that an error occurred when establishing a connection.

Parameters:

  • voiceChatService (GKVoiceChatService)

    The voice chat service that was establishing the connection.

  • participantID (String)

    A string that uniquely identifies the other user.

  • error (NSError)

    The error that prevented the voice chat from being established.

Returns:

- (Object) voiceChatService(voiceChatService, didReceiveInvitationFromParticipantID:participantID, callID:callID)

Asks the client to accept or reject an invitation from a remote participant. If this method is not implemented by the client, the voice chat service automatically accept requests from other participants.This method should call the service’s acceptCallID:error: method if it wants to accept the request or the denyCallID: to reject it.

Parameters:

  • voiceChatService (GKVoiceChatService)

    The service that received the request.

  • participantID (String)

    A string that uniquely identifies the other user.

  • callID (Integer)

    An integer that uniquely identifies the request.

Returns:

- (Object) voiceChatService(voiceChatService, didStartWithParticipantID:participantID)

Received by the client when a voice chat with another participant is established. Your client can use this method to update the user interface to show that a connection has been established.

Parameters:

  • voiceChatService (GKVoiceChatService)

    The voice chat service that initiated the connection.

  • participantID (String)

    A string that uniquely identifies the other user.

Returns:

- (Object) voiceChatService(voiceChatService, didStopWithParticipantID:participantID, error:error)

Received by the client when a previously established voice chat has ended. Your application can implement this method to notify the user that an established voice connection has ended. This may occur when another participant ends the chat or if the network connection was lost.

Parameters:

  • voiceChatService (GKVoiceChatService)

    The voice chat that maintained the connection.

  • participantID (String)

    A string that uniquely identifies the user who disconnected.

  • error (NSError)

    The error that caused the chat to end.

Returns:

- (Object) voiceChatService(voiceChatService, sendData:data, toParticipantID:participantID)

A request for the client to send data to a participant. (required) An implementation of this method must reliably transmit the data to the participant identified by participantID. When the client on the other end receives the data, it should forward it to the voice chat service by calling the service’s receivedData:fromParticipantID: method.

Parameters:

  • voiceChatService (GKVoiceChatService)

    The service that requested the transmission.

  • data (NSData)

    The data to send.

  • participantID (String)

    A string that uniquely identifies the participant to send the data to.

Returns:

- (Object) voiceChatService(voiceChatService, sendRealTimeData:data, toParticipantID:participantID)

Asks the client to send data to a participant that must get there quickly. An implementation of this method maps the participantID string to a known participant and transmits the data to them. Data transmitted by this method can be sent unreliably. When the client on the other end receives this data, it should forward it to the voice chat service by calling the service’s receivedRealTimeData:fromParticipantID: method.

Parameters:

  • voiceChatService (GKVoiceChatService)

    The service that requested the transmission.

  • data (NSData)

    The data to send.

  • participantID (String)

    A string that uniquely identifies the participant to send the data to.

Returns: