Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

9. Audio and Video > 9.3. Recording Audio

9.3. Recording Audio

Problem

You want to be able to record audio files on an iOS device.

Solution

Make sure you have added the CoreAudio.framework framework to your target file, and use the AVAudioRecorder class in the AV Foundation framework:

NSError   *error = nil;

NSString *pathAsString = [self audioRecordingPath];

NSURL *audioRecordingURL = [NSURL fileURLWithPath:pathAsString];

self.audioRecorder = [[AVAudioRecorder alloc] 
                      initWithURL:audioRecordingURL
                      settings:[self audioRecordingSettings]
                      error:&error];

For information about the audioRecordingSettings and audioRecordingPath methods used in this example, refer to this recipe’s Discussion.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint