我最近在我的应用程序中发现了一个漏洞。我把所有的代码都注释掉了,一步一步地去掉了注释。这一切都导致了AVAudioRecorder。
查看控制器h:
#import <AVFoundation/AVFoundation.h>
@interface ViewController : UIViewController {
AVAudioRecorder *recorder;
}视图控制器m:
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;
recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error];
if (recorder) {
[recorder prepareToRecord];
recorder.meteringEnabled = YES;
[recorder record];
}

很抱歉这张小照片。内存泄漏只有16个字节,我无法追溯到代码,因为它不允许我这样做,所以我只使用了注释策略。无论何时退出视图控制器,都会使用[recorder stop];。
有什么想法吗?
发布于 2014-08-26 12:55:21
https://stackoverflow.com/questions/25495002
复制相似问题