ExtAudioFileOpenURL gives bad access..???

Discussion in 'iOS Programming' started by SameeraB, Dec 21, 2008.

  1. macrumors newbie

    Nov 18, 2008
    Hello All,

    I have to convert an audio file from one from to another in iPhone. I found that we have afconvert in apple developer's example. I tried to use it in my iPhone App. I created a sample application having the files that afconvert uses in /Developer/Example/CoreAudio/Serives/AudioFileTools. But it gives me exec-bad-access when i execute the ExtAudioFileOpenURL api.

    I have my input file names "test.mp3" in app's document folder.

    Following is the code snippet..

    NSArray * arr = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
    NSString *str = [arr objectAtIndex:0];
    NSString *str1 = [NSString stringWithFormat:mad:"%@/test.mp3", str];
    //NSLog(@"%@", str1);

    ExtAudioFileRef file = NULL;
    CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)str1, kCFURLPOSIXPathStyle, FALSE);
    ExtAudioFileOpenURL(url, &file);

    //release the allocated resource

    I received "EXC_BAD_ACCESS" in ExtAudioFileOpenURL... :(

    Can anybody please help me.. Please..
    Thanks in an advance.

  2. Moderator emeritus


    Jun 15, 2000
    Make sure 'url' is actually a valid object. It might be null.
  3. thread starter macrumors newbie

    Nov 18, 2008

    I have checked it.. it is the proper "url".. :(
    Anything else I need to look into.. I'm sure i must be missing something..

    thanks for the help in an advance
  4. thread starter macrumors newbie

    Nov 18, 2008
    I have ensured validity of url by using this url with the AudioFileOpenUrl api.
    It works fine.
  5. thread starter macrumors newbie

    Nov 18, 2008

Share This Page