Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AVAudioSession doesn't exist in AVFoundation framework

I am trying to use AVAudioSession in Xcode for my Mac OS application, but Xcode when I try using this code:

import Foundation
import AVFoundation

var recordingSession: AVAudioSession!

Xcode gives me a error: "Use of undeclared type 'AVAudioSession'"

I have correctly linked the AVFoundation framework to my project, but it still gives that error.

Upon looking into the current AVFoundation framework, I found that AVAudioSession header does not exist inside of AVFoundation. I have looked all over Google and have found no evidence of anybody else having this issue, and Apple has not deprecated AVAudioSession.

Is AVAudioSession residing in some other framework?

like image 573
Taras Palczynski Avatar asked Mar 02 '26 20:03

Taras Palczynski


1 Answers

It looks like AVAudioSession is only available on iOS. Here is the AVFoundation programming guide for Mac:

https://developer.apple.com/library/mac/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/00_Introduction.html#//apple_ref/doc/uid/TP40010188

...and the AVFoundation API for Mac:

https://developer.apple.com/library/mac/navigation/index.html?filter=avfoundation#section=Resource%20Types&topic=Reference

Example from Apple on how to record audio (and video):

https://developer.apple.com/library/mac/samplecode/AVRecorder/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011004

like image 56
markwatsonatx Avatar answered Mar 05 '26 19:03

markwatsonatx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!