Using the iOS device's microphone to record

In this recipe we will learn how we can use the iOS device's microphone to record sounds.

Getting ready

Following on from our previous recipe, create a new Single View Application, and name it RecorderExample.

How to do it...

To begin, follow these simple steps as outlined in the following order:

  1. Add a reference to the AVFoundation.framework to your project.
  2. Select the ViewController.xib files from the Project Navigator window.
  3. From the Object Library window, select and drag a UIToolbar object, and add this to our view and select the Item button located within our toolbar.
  4. From the Attributes Inspector section, change the Title property to read Start Recording.
  5. Create the outlet for this UIBarButtonItem

Get Xcode 4 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.