Hi all,
This is issue has been frustrating me for about 2 hours now. I can't figure it out, likely because I'm a newbie. I'm trying to just simply record and playback a sound file. In the simulator, the following works just fine:
Code:
recordedFile = [NSURL fileURLWithPath:[NSString stringWithFormat: @"%@/recordedSound.caf",[[NSBundle mainBundle] resourcePath]]];
...
recorder = [[ AVAudioRecorder alloc] initWithURL:recordedSound settings:recordSetting error:&error];
I'm able to record and playback sounds with the appropriate buttons in the application when in simulator. But when I try it on the device, it doesn't seem to actually record anything, and it does not play back. I've figured out a way to make it work on the device, by replacing the above first line with this:
Code:
recordedSound = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent: [NSString stringWithFormat: @"recordedSound.%@", @"caf"]]];
This tells me that it's not an issue with the recorder, but just with where I'm creating the file. But I don't want the file in a temporary directory. I want it to be located at "Application.app/recordedSound.caf." What am I missing here? I can feel that there's an easy fix, but I can't figure out what that is.
Thanks so much for the help!!