Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7791689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:57:58+00:00 2026-06-01T21:57:58+00:00

My problem is – when audio is playing in background in my iPad then

  • 0

My problem is – when audio is playing in background in my iPad then “my app icon” is not coming. I am using iPodMusicPlayer. For playing audio in background I have write these code..

- (void)viewDidAppear:(BOOL)animated {
      [super viewDidAppear:animated];
      [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
      [self becomeFirstResponder];
}

- (void)viewWillDisappear:(BOOL)animated
{
     [[UIApplication sharedApplication] endReceivingRemoteControlEvents];
     [self resignFirstResponder];
     [super viewWillDisappear:animated];
}

- (BOOL)canBecomeFirstResponder {
        return YES;
}

// The iPod controls will send these events when the app is in the background

- (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent {
       if (receivedEvent.type == UIEventTypeRemoteControl) {
           switch (receivedEvent.subtype) {

           case UIEventSubtypeRemoteControlTogglePlayPause:
               [self performSelector:@selector(playPause:)];
               break;

           case UIEventSubtypeRemoteControlPreviousTrack:
            //[self previousSong:nil];
            //[self performSelector:@selector(previousSong:)];
            break;

           case UIEventSubtypeRemoteControlNextTrack:
               //[self performSelector:@selector(nextSong:)];
               break;
          default:
              break;
         }
     }
}

and info.plist I have also set “required background mode”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:58:00+00:00Added an answer on June 1, 2026 at 9:58 pm

    You will also have to add UIBackgroundModes to your Info.plist and set its value to audio.

    Please check the iOS App Programming Guide, specifically the App States and Multitasking section for detailed info on how to execute tasks in background.

    [UPDATE]

    Also add these two lines to application:didFinishLaunchingWithOptions: in your AppDelegate.m:

    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
    [[AVAudioSession sharedInstance] setActive: YES error: nil];
    

    And this code when you start playing your audio:

    UIBackgroundTaskIdentifier newTaskId = UIBackgroundTaskInvalid;
    [_player play];
    newTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:NULL];
    

    This should do it. Tested in the simulator, as well as on a device.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem background: I have a Qt/QML Symbian application targeting Qt 4.7.4, that requires a
Problem I have a Silverlight 5 application using the treeview from the SDK. Now
problem I'm using LilyPond to typeset sheet music for a church choir to perform.
Problem: I am using Windows as a guest operating system in a Virtual Machine
Problem: to show that a Not-SO-page has been discussed in SO when you at
Problem solved, see below Question I'm working in Flex Builder 3 and I have
(Problem solved now, see answers below) Hello, in my app I am trying to
Problem: I can set the exposureMode property of AVCaptureDevice, but it does not stay
Problem Description: We have a service which has applications for main mobile OS’s. We
Problem! I Have the following input (rules) from a flat file (talking about numeric

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.