Joins a voice channel.
- iOS 4.0+
- macOS 10.8+
- tvOS 9.0+
The channel to join.
An autoreleased voice chat object for the voice channel, or
nil if an error occurred.
Calling this method joins a voice channel, creating it if necessary. Your game should keep a strong reference to the voice chat object until the player leaves the channel. All participants who join a channel with the same name are connected to each other.
A single match can have multiple voice chat channels, and any player in the match can join multiple channels simultaneously. For example, a team-based game might create a channel for each team, and a single channel that includes all of the players.
Voice chat objects are dependent on the network connection provided by the match. When the player disconnects from the match, all voice channels associated with that match stop working. Typically, you should exit any voice channels and release any strong references to the channels before disconnecting from the match.
Parental controls may prevent a player from joining a voice chat. If the player is not permitted to join the voice channel, a
nil object is returned to your application.
Listing 1 provides code that creates two channels. The first call to the
voice method creates a team channel and the second creates a global channel. The code Memory management both channels.