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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:49:58+00:00 2026-06-09T12:49:58+00:00

According to the apple documentation, AudioServices.h should be part of the AudioToolbox framework. Even

  • 0

According to the apple documentation, AudioServices.h should be part of the AudioToolbox framework.

Even though I have added the AudioToolbox framework to my Xcode project, when I #import AudioServices I get the error: AudioServices.h file not found.

This happens whether I type
#import “AudioServices.h”

or
#import “AudioToolbox/AudioServices.h”
.

Just in case, I tried removing and then re-adding the AudioToolbox framework, which had no effect. Could the AudioServices file be corrupted somehow? (If so, does anyone know where I could download another copy?)

I am using XCode 4.2, but as I am converting some old open source code, the project is set to be XCode 3.2-compatible. Could this be the issue?

I’m sure I’m missing something simple. I am totally new to programming… any help appreciated!

—–EDIT (see my comment below)—–

in AudioServices.h, the two functions in question:

extern OSStatus
AudioSessionInitialize( CFRunLoopRef                        inRunLoop, 
                        CFStringRef                         inRunLoopMode, 
                        AudioSessionInterruptionListener    inInterruptionListener, 
                        void                                *inClientData)              

extern OSStatus
AudioSessionAddPropertyListener(    AudioSessionPropertyID              inID,
                                    AudioSessionPropertyListener        inProc,
                                    void                                *inClientData)

in SpeakHereController.mm (from sample Apple code), which I am trying to convert to ARC to get it to cooperate better with the other files in my project:

- (void)awakeFromNib
{       

// Allocate our singleton instance for the recorder & player object
recorder = new AQRecorder();
player = new AQPlayer();


OSStatus error = AudioSessionInitialize(NULL, NULL, interruptionListener, self);
if (error) printf("ERROR INITIALIZING AUDIO SESSION! %ld\n", error);
else 
{
    UInt32 category = kAudioSessionCategory_PlayAndRecord;  
    error = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(category), &category);
    if (error) printf("couldn't set audio category!");

    error = AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange, propListener, self);
    if (error) printf("ERROR ADDING AUDIO SESSION PROP LISTENER! %ld\n", error);
    UInt32 inputAvailable = 0;
    UInt32 size = sizeof(inputAvailable);

    // we do not want to allow recording if input is not available
    error = AudioSessionGetProperty(kAudioSessionProperty_AudioInputAvailable, &size, &inputAvailable);
    if (error) printf("ERROR GETTING INPUT AVAILABILITY! %ld\n", error);
    btn_record.enabled = (inputAvailable) ? YES : NO;

    // we also need to listen to see if input availability changes
    error = AudioSessionAddPropertyListener(kAudioSessionProperty_AudioInputAvailable, propListener, self);
    if (error) printf("ERROR ADDING AUDIO SESSION PROP LISTENER! %ld\n", error);

    error = AudioSessionSetActive(true); 
    if (error) printf("AudioSessionSetActive (true) failed");
}
  • 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-09T12:50:00+00:00Added an answer on June 9, 2026 at 12:50 pm

    The problem is that the system can’t cast self to void * automatically when you’re using ARC. Self is used in the last parameter of AudioSessionInitialize function (and others).

    You need to tell ARC how the ownership of the memory is controlled by manually casting it to void * using __bridge. This says ‘Don’t change ownership of the memory’.

    So change self to (__bridge void *)self in the calls to the AudioSession functions.

    e.g.

    OSStatus error = AudioSessionInitialize(NULL, NULL, interruptionListener, (__bridge void*)self);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to Apple documentation and other documentation I have read about on disk encryption
According to Apple's documentation here , this should work in my code: @interface Menu
I'm trying to use CGBitmapContextCreate . According to Apple's documentation the ApplicationServices framework is
i have a application i put Default.png for splash screen according to apple's documentation.the
According to Apple documentation on debugging Core Data it says we should be able
According to my understanding of the Apple's documentation the 'CIFaceFeature' class' object is a
According to Apple's guide line, an iPhone app's launch image/splash screen should be a
I have an iOS (Obj-C) project that uses ARC (Automatic Reference Counting). According to
According to Apple's documentation on the View Controller Lifecycle I noticed the following regarding
According to Apple's documentation , in order to make phone call from my app,

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.