Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8307885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:38:22+00:00 2026-06-08T18:38:22+00:00

I am using AVAudioRecorder in my mac app. In my .m file I declare

  • 0

I am using AVAudioRecorder in my mac app. In my .m file I declare

@interface RecordViewController ()
{
    AVAudioRecorder *audioRecorder;
...
}
@end

further down I then alloc init the object like so:

audioRecorder = [[[AVAudioRecorder alloc] initWithURL:soundFileURL settings:recorderSettings error:&error] retain];
...
[audioRecorder prepareToRecord];
...
[audioRecorder record];

I can see that the file gets created, but it only has 4KB. I do not get an error but when I test if [audioRecorder isRecording] I can see that [audioRecorder is no longer recording. I am assuming that the object got released, even though I am not using ARC and the dealloc method was not called.

I had a similar problem with the AVAudioPlayer but the additional retain] appended to the alloc init solved that.

What am I doing wrong?

Thanks

UPDATE 1:

I have even tried to do the following (all in the same method):

[audioRecorder record];
NSLog(@"recording is ... %d", [audioRecorder isRecording]);

and the result is 0.
???

Do I have to use self ? or lazily instantiate audioRecorder?

UPDATE 2:
I recreated the project – called it TEST and copied the source code from my old project. Now it works?!?! Go figure. The source codes are line for line the same. Is this a known problem with XCode?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:38:23+00:00Added an answer on June 8, 2026 at 6:38 pm

    First of all, based on your comment, if you can still access the instance means that your object isn’t dealloc.

    AVAudioRecorder provide a delegate (AVAudioRecorderDelegate) have you tried to use the delegate for log if the recording is successfully or you get some error?

    Particularly the method audioRecorderEncodeErrorDidOccur:error: should give you some error if occurred while recording.

    BTW the additions retain] is not need because whit alloc init you’ve got the ownership of the object and you should release.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am recording a 16bit linear PCM file using AVAudioRecorder , saving it to
I am using AVAudioRecorder to record audio and save to a wav file (using
Possible Duplicate: Delay in Recording using avaudiorecorder I am running an app on Xcode4
I am developing an iphone app with the capability of recording voice using AVAudioRecorder.Currently
I have a view in which I record sound using AVAudiorecorder and then it
I am using the AVAudioRecorder class to record to a wav file. I would
In my app, I am using the AVAudioRecorder to detect input from the microphone.
I need to pause and then resume an audio recording, I'm using AVAudioRecorder for
How to record audio as an mp3 file by using AvAudiorecorder? I am using
I'd like to be able to play back audio I've recorded using AVAudioRecorder @

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.