AVAudioRecorder

Hi,


(AVAudioRecorder *_recorder;)

[_recorder recordForDuration:duration];


Returns error -50. But I can't find what error -50 is.

I'm using a temporary folder to save the recorded audio. Was wondering if it's something to do about the temporary folder (Sandboxing permissions etc).


NSURL *url = [[NSURL alloc] initFileURLWithPath:@"/etexttemp"];

recAudioFolder = [[NSFileManager defaultManager] URLForDirectory:NSItemReplacementDirectory

inDomain:NSUserDomainMask

appropriateForURL:url

create:YES

error:&error];


I'm updating the code from 10.7 to 10.11. It works OK on 10.7. Any help appreciated. Thanks

Paul

Accepted Reply

Thanks for your help, QuinceyMorris.

It was a sandboxing issue in the ".entitlements" which caused the problem. All fixed now.

Replies

Hi,


It's actually:-


1152: AudioConverterNew returned -50

Any help appreciated. Thanks,


Paul

It's a bit useless to give an error code if you can't find out what it means.

There is a useful site called "osstatus.com" where you can look up error numbers. In this case, it says that -50 is an invalid parameter.

I suspect the problem is that your file "etexttemp" doesn't exist, and the -50 means your "appropriateForURL:" parameter isn't valid.


Instead, you should use a URL for the actual directory you will eventually save the recorded file to. This may come from asking the user with NSSavePanel, or could default to the user's Documents or Desktop folder.

Thanks for your help, QuinceyMorris.

It was a sandboxing issue in the ".entitlements" which caused the problem. All fixed now.