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

  • SEARCH
  • Home
  • 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 9155345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:34:36+00:00 2026-06-17T12:34:36+00:00

I am trying to let my program playing a recurring sound in background. add

  • 0

I am trying to let my program playing a recurring sound in background.

  1. add (Required Background Modes) property and (apps play audio) in info.plist.

  2. In my storyboard, app starts a UINarvigation controller with a root TableViewController. have #import in my Root TableViewController.m.

  3. There is a NSTimer property, my_timer, in my Root TableViewController. I set it in viewDidLoad method as following:

my_timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector: @selector(doMyFunction) userInfo:nil repeats:YES];

  1. In doMyFunction method, I have playSystemSound(1003).

My app plays sounds periodically as expected when in front mode, but never gets played in back ground mode. I can’t figure out what is done not correctly, thank for your help.

  • 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-17T12:34:37+00:00Added an answer on June 17, 2026 at 12:34 pm

    playSystemSound will never play audio in background. To do that call this function in your main source code, just afer ViewDidLoad:

    -(void)createAudioSession 
    {
    
        // Registers this class as the delegate of the audio session.
        [[AVAudioSession sharedInstance] setDelegate: self];
    
        // Use this code instead to allow the app sound to continue to play when the screen is locked.
        [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
    
        NSError *myErr;
    
        AVAudioSession *audioSession = [AVAudioSession sharedInstance];
        [audioSession setCategory:AVAudioSessionCategoryPlayback error:&myErr];
    
    }
    

    Then

    AVAudioPlayer * FXPlayer;
    
    FXPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:resourcePath] error:&err];
    
    FXPlayer.numberOfLoops = -1; // will loop forever
    
    [FXPlayer play];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the program to let me enter a users name and
I am trying to get a program to let a user enter a word
I'm trying to make a program which Takes the user input (let's say all
let me explain well.. I'm trying to write a program that listen the keys
I am trying to create an integration between a 3rd party Lisp-based program (Let's
I'm trying to get a program to let the user to import a custom
Let's say I'm trying to log some program's output to DynamoDB table, but I
Ok. Let me start again. I am trying to write a program that would
I'm trying to make a program that won't let you continue if a certain
I'm trying to let users type in date and time values into an input

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.