GKVoiceChatClient Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/GameKit.framework
Availability
Available in iOS 3.0 and later.
Companion guide
Declared in
GKPublicProtocols.h

Overview

The GKVoiceChatClient protocol is implemented to control the behavior of the GKVoiceChatService object. The voice chat client has a number of responsibilities:

Tasks

Getting Information About the Participant

Sending Data to Other Participants

Accepting Invitations from Remote Participants

Responding to Changes in Other Participants

Instance Methods

participantID

Returns a string that uniquely identifies the local user. (required)

- (NSString *)participantID
Return Value

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

Discussion

The client decides the format and meaning of the participant identifier. For more information, see the Game Center Programming Guide.

Availability
  • Available in iOS 3.0 and later.
Declared In
GKPublicProtocols.h

voiceChatService:didNotStartWithParticipantID:error:

Received by the client when an attempt to establish a voice chat with another participant failed.

- (void)voiceChatService:(GKVoiceChatService *)voiceChatService didNotStartWithParticipantID:(NSString *)participantID error:(NSError *)error
Parameters
voiceChatService

The voice chat service that was establishing the connection.

participantID

A string that uniquely identifies the other user.

error

The error that prevented the voice chat from being established.

Discussion

Your application can implement this method to notify the user that an error occurred when establishing a connection.

Availability
  • Available in iOS 3.0 and later.
Declared In
GKPublicProtocols.h

voiceChatService:didReceiveInvitationFromParticipantID:callID:

Asks the client to accept or reject an invitation from a remote participant.

- (void)voiceChatService:(GKVoiceChatService *)voiceChatService didReceiveInvitationFromParticipantID:(NSString *)participantID callID:(NSInteger)callID
Parameters
voiceChatService

The service that received the request.

participantID

A string that uniquely identifies the other user.

callID

An integer that uniquely identifies the request.

Discussion

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.

Availability
  • Available in iOS 3.0 and later.
Declared In
GKPublicProtocols.h

voiceChatService:didStartWithParticipantID:

Received by the client when a voice chat with another participant is established.

- (void)voiceChatService:(GKVoiceChatService *)voiceChatService didStartWithParticipantID:(NSString *)participantID
Parameters
voiceChatService

The voice chat service that initiated the connection.

participantID

A string that uniquely identifies the other user.

Discussion

Your client can use this method to update the user interface to show that a connection has been established.

Availability
  • Available in iOS 3.0 and later.
Declared In
GKPublicProtocols.h

voiceChatService:didStopWithParticipantID:error:

Received by the client when a previously established voice chat has ended.

- (void)voiceChatService:(GKVoiceChatService *)voiceChatService didStopWithParticipantID:(NSString *)participantID error:(NSError *)error
Parameters
voiceChatService

The voice chat that maintained the connection.

participantID

A string that uniquely identifies the user who disconnected.

error

The error that caused the chat to end.

Discussion

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.

Availability
  • Available in iOS 3.0 and later.
Declared In
GKPublicProtocols.h

voiceChatService:sendData:toParticipantID:

A request for the client to send data to a participant. (required)

- (void)voiceChatService:(GKVoiceChatService *)voiceChatService sendData:(NSData *)data toParticipantID:(NSString *)participantID
Parameters
voiceChatService

The service that requested the transmission.

data

The data to send.

participantID

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

Discussion

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.

Availability
  • Available in iOS 3.0 and later.
Declared In
GKPublicProtocols.h

voiceChatService:sendRealTimeData:toParticipantID:

Asks the client to send data to a participant that must get there quickly.

- (void)voiceChatService:(GKVoiceChatService *)voiceChatService sendRealTimeData:(NSData *)data toParticipantID:(NSString *)participantID
Parameters
voiceChatService

The service that requested the transmission.

data

The data to send.

participantID

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

Discussion

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.

Availability
  • Available in iOS 3.0 and later.
Declared In
GKPublicProtocols.h