1

I have successfully been running this AVAudioRecorder example through a regular XCode based project. I would like to record from a daemon application running on a jailbroken device and tried to implement the same functionality from a simple command line app.

In my simple test, I start the recording from main and sleep for a few seconds before stopping the recording. The result is always the same: A truncated .caf file of size 4096 bytes (looks like a correct header and null data). It doesn't make any difference if I initiate the recording from a separately spawned thread. I tried both record() and recordForDuration().

All methods invoked return an OK result. If I invoke recording() on the AVAudioRecorder instance, it returns YES while recording.

Do I miss some fundamental initialization that a regular XCode based GUI app takes care of behind the scenes?

Community
  • 1
  • 1
  • More likely the run-loop is never getting run because you've slept from the main thread? – marko Apr 27 '13 at 22:18
  • You are indeed correct! I followed this very good article on the subject and now it works like a charm: http://chrisalvares.com/blog/7/creating-an-iphone-daemon-part-1. If you put your comment as an answer, I'll mark it as accepted. Thanks a lot! – user2327685 Apr 28 '13 at 20:27

0 Answers0