audio - Sound does not play when going to another view controller (iOS) -


on the button to press "back to the menu" there is a sound that should be played, but not because of the sound moving to the main visual navigation controller I have to do it waits for the sound before going back, but it does not work, what should I do

  If (appDelegate.disabledSoundEffects == 0) [Self PerformSelectorOnMainThread: @ Selector (Playbootsound) with Op Ekt faucet Prticshauniton: true];  

playButtonSound method that sound is clearly plays that I address it in case there'm wrong

  dispatch_queue_t dispatchQueue = dispatch_get_global_queue ( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_sync (dispatchQueue, ^ (void) {NSBundle * mainBundle = [NSBundle mainBundle]; NSString * FilePath = [mainBundle pathForResource: @ "clickSound" ofType: @ "MP 3"]; NSData * fileData = [NSData dataWithContentsOfFile: filepath]; NSError * error = nil; self.audioPlayer = [[AVAudioPlayer alloc] initWithData: fileData error: & amp; error], if (self.audioPlayer = zero!) self.audioPlayer.delegate = self [self.audioPlayer prepareToPlay]; [ Self. Play audio player];});  

@Surjeet "as

said AVAudioPlayer allocation within Instead square . Create a method for the allocation class, then Aepdelig in AppDelegate, and that method calls, click any class button. this way your voice is always plays. "


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -