With an 'Analyze', in the dealloc I get: Incorrect decrement of the reference count of an object that is not owned at this point by the caller
#import <AVFoundation/AVFoundation.h>
@interface XYZViewController : UIViewController
@property (retain) AVAudioRecorder *recorder;
@end
@implementation XYZViewController
@synthesize recorder;
- (void) dealloc
{
[self.recorder release];
[super dealloc];
}
- (void) viewDidLoad
{
NSURL *url = [NSURL fileURLWithPath:@"/dev/null"];
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: 44100.0], AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey,
nil];
NSError *error;
self.recorder = [[[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error] autorelease];
}
@end
Does it mean I shouldn't release it?
Also, I tried to 'Profile' the code and I get a memory leak from [[[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error] autorelease] no matter what.