Putting It Together
In this chapter, we modify our existing code base from Chapter 8. Begin there by creating a new audio session for your voice chat service. Add the following block of code to the UFOGameViewController.m viewDidLoad: method. In addition, you need to add the AVFoundation.framework to your project. Modify the relevant section of the viewDidLoad method to match the following.
if (self.gameIsMultiplayer == NO)
{
for (int x = 0; x < 5; x++)
{
[self spawnCow];
}
[self updateCowPaths];
}
else
{
[self generateAndSendHostNumber];
NSError *error = nil;
AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; ...
Get Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch now with the O’Reilly learning platform.
O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.