SBM SBM - 3 months ago 6
iOS Question

AVAudioPlayer doesn't play audio after the home button is pressed

I'm new in ios development.I'm using AVAudioPlayer.The audio plays in foreground. After that when i tapped the home button the app comes to background but the audio was muted.


Try this,

- (void)applicationDidEnterBackground:(UIApplication *)application
__block UIBackgroundTaskIdentifier task = 0;
task=[application beginBackgroundTaskWithExpirationHandler:^{
    NSLog(@"Expiration handler called %f",[application backgroundTimeRemaining]);
    [application endBackgroundTask:task];