Hello all,
I have created a sample application using the iPhone SDK that uses ExtAudioFileOpenURL from the AudioToolBox framework. I have a test.mp3 audio file in my app's document folder. When I tried to open this audio file using this API I received EXEC_BAD_ACCESS. I couldn't figure out why.
Here is a code snippet:
NSArray *arr = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *str = [arr objectAtIndex:0];
NSString * temp = [NSString stringWithFormat:@"%@/test.mp3", str];
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)temp, kCFURLPOSIXPathStyle, false);
//AudioFileID fileID ;
//AudioFileOpenURL(url, 0X01, kAudioFileCAFType, &fileID);
ExtAudioFileRef audioFileRef = NULL;
ExtAudioFileOpenURL(url, &audioFileRef);
I get EXC_BAD_ACCESS when I try the ExtAudioFileOpenURL. I thought it was because of the invalid URL passed. But when I tried AudioFileOpenURL it worked fine ensuring me that the URL is valid.
Please help me.
Thanks in advance.