Search code examples
iphoneiosios5avaudioplayer

Control AVAudioPlayer of one class in Appdelegate class


I have an AVAudioPlayer object in one class and i want to control that object from appdelegate. I tried setting property of AVAudioPlayer object in that class and stopping the audioplayer object from appdelegate but its not working. Can anyone help me to find solution of this problem?


Solution

  • You can do it by just add one method for stopping AVAudioPlayer in the same class where you are having AVAudioPlayer object and call that method from appdelegate. Or make AVAudioPlayer object in appdelegate and in your class create shared object of appDelegate class. and then use that AVAudioPlayer object in your class.