Crashes when using AVAudioPlayer on iPhone -
I am trying to use an aviable player to play some sounds in quick succession. When I call the sound-play function less frequently, so that the function plays fully before applying the replay, the app is running fine. But if I quickly call the function in succession (sounds like the previous voices are still being played, the sounds are played), the app eventually calls for a function with the message "20 EXC_BAD_ACCESS" Here's the code from the function:
NSString * nsWavPath = [[NSBundle mainBundle] resourcepath] stringbappingpath company: wavFileName]; AviDio Player * theAudio = [[AviPro Player Alok] initWithContentsOfURL: [Text with NSUr File URL: NSWPath] Error: Null]; TheAudio.delegate = self; [Audio game]; As mentioned in another thread, I have implemented the following representative work: - (zero) Audioplayer diffinet playing: (AviPlayer) * Successfully: (BOOL) Flag {if ) NSLog (@ "Audio did not end successfully \ n"); [Player release]; }
But the app still crashes after ~ 20 intense calls for the function Any thoughts that I am doing wrong? First of all: Make sure that you are not trying to play a second time sound which is already in front of you. The same has been released through [player release];
If you are, you will get that error message right away, once you leave the player associated with a particular sound, you can not play the file again, as you have shown here. Try commenting that line of code and see what happens to it still.
I have also run on an issue where AVAudioPlayer <321kb is created every time a new player
and if you have enough voices Can get out and get the accident. I am very doubtful that this is your problem, although it usually does not throw that error code.
EXC_BAD_ACCESS
is usually trying to use an indicator that no longer exists (such as
player
objects for most cases)
Comments
Post a Comment