0

I'm working on a simple Cocoa application that retrieve the meters from an AVAudioRecorder. Here is my code:

@interface AppDelegate () <AVAudioRecorderDelegate>

@property (weak) IBOutlet NSWindow *window;
@property (strong) AVAudioRecorder *recorder;
@property (strong) NSURL *dump;

@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    NSDictionary *settings = @{AVSampleRateKey: @(44100.0),
                               AVNumberOfChannelsKey: @2,
                               AVFormatIDKey: @(kAudioFormatAppleLossless),
                               AVEncoderAudioQualityKey: @(AVAudioQualityHigh)
                               };
    NSError *error = nil;
    self.dump = [[NSURL alloc] initFileURLWithPath: [NSTemporaryDirectory() stringByAppendingString: @"dump"]];
    self.recorder = [[AVAudioRecorder alloc] initWithURL: self.dump
                                                settings: settings
                                                   error: &error];
    NSLog(@"Recorder, got error? %@", error);
    self.recorder.delegate = self;

    [self.recorder prepareToRecord];
    self.recorder.meteringEnabled = YES;
    [self.recorder record];
}

@end

I also have a timer that retrieves the meters every second. It works on my laptop but on my iMac, for some reason I have a BAD_ACCESS on "com.apple.audio.IOThread.client (8)" when I call record.

Any idea ?

Thanks!

Romain Pouclet
  • 864
  • 2
  • 8
  • 17
  • Presumably there's a problem with the configuration of that computer. Try it in a new clean user, perhaps. You might have a bad plug-in, driver, etc. In any case it has nothing to do with your code. – matt Nov 05 '14 at 18:46
  • I built the application on mu laptop and ran it on my iMac and indeed it works, I don't get it... – Romain Pouclet Nov 06 '14 at 15:42
  • Okay, so when you get the bad access, is this when running in Xcode? In other words, is the distinction it works built on laptop but not built on iMac, or it works run standalone but not running inside Xcode? – matt Nov 06 '14 at 16:08
  • It works from Xcode on my laptop. but not on my iMac. Once archived, I can run it on my laptop and my iMac. – Romain Pouclet Nov 06 '14 at 16:10
  • But if you build-and-archive it on the iMac you can run it on the iMac? – matt Nov 06 '14 at 16:17

0 Answers0