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 8379529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:12:52+00:00 2026-06-09T16:12:52+00:00

I have a need to play a brief sound 3 seconds or so (like

  • 0

I have a need to play a brief sound 3 seconds or so (like a count down beep) before I perform some other action in an iOS application.

The use case is as follows:

User clicks a button… the beeps play (simple beeps using AudioServicesPlaySystemSound… then the rest of the method is run.

I cannot seem to find out a way to block my method while the tones are playing.

I’ve tried the following:

[self performSelector:@selector(playConfirmationBeep) onThread:[NSThread currentThread] withObject:nil waitUntilDone:YES];

But the tones play synchronously while the rest of the method is performed.

What am I missing with the above call?

  • 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-09T16:12:54+00:00Added an answer on June 9, 2026 at 4:12 pm

    AudioServicesPlaySystemSound is asynchronous so you can’t block on it. What you want to do is get the audio services to notify you when playback is finished. You can do that via AudioServicesAddSystemSoundCompletion.

    It’s a C-level API so things are a bit ugly, but you probably want something like:

    // somewhere, a C function like...
    void audioServicesSystemSoundCompleted(SystemSoundID ssID, void *clientData)
    {
        [(MyClass *)clientData systemSoundCompleted:ssID];
    }
    
    // meanwhile, in your class' init, probably...
    AudioServicesAddSystemSoundCompletion(
       soundIDAsYoullPassToAudioServicesPlaySystemSound,
       NULL, // i.e. [NSRunloop mainRunLoop]
       NULL, // i.e. NSDefaultRunLoopMode
       audioServicesSystemSoundCompleted,
       self);
    
    // in your dealloc, to avoid a dangling pointer:
    AudioServicesRemoveSystemSoundCompletion(
                 soundIDAsYoullPassToAudioServicesPlaySystemSound);
    
    // somewhere in your class:
    - (void)systemSoundCompleted:(SystemSoundID)sound
    {
        if(sound == soundIDAsYoullPassToAudioServicesPlaySystemSound)
        {
            NSLog(@"time to do the next thing!");
        }
    }
    

    If you actually want to block the UI while the sound is playing, and assuming your class is a view controller, you should probably just disable self.view.userInteractionDisable for the relevant period. What you definitely don’t want to do is block the main run loop; that’ll stop important system events like low memory warnings getting through and hence potentially cause your app to be force quit. You also probably still want to obey things like device rotations.

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

Sidebar

Related Questions

Assume I have 3 teams that each need to play each other once. How
I just need to play a simple sound, I have app that send messages,
I have a need to play sound via the sound card of server PC
I have some code that needs adjusting. I need the .play rel to be
I have 5 songs which i need to play one after the other, and
I have a requirement where i need to play a notification sound only when
I need to play a sound when a button is clicked, I have this:
i have to make an application where i need to play two video simultaniously,on
I have an aes encrypted mp3 file that I need to play in iOS;
I have a video, and I need to play it in my ASP.NET page's

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.