Prevent(or detect) audio feedback in ios

Hello everyone,

I wonder if there is a way to detect and prevent audio feedback in ios.

I’m trying to make an app that receives audio stream from the microphone, and then plays it back through the audio output, with tiny bit of modification of the input stream.
It will definitely be used with a headphone, but for safety reason, I want the app to run only if an audio output device is connected.
The first idea i’ve got is to look up if there are available devices other than the default one.
But I just ended up here

vector<ofSoundDevice> ofxiOSSoundStream::getDeviceList(ofSoundDevice::Api api)  const{
	ofLogWarning("ofxiOSSoundStream") << "getDeviceList() isn't implemented on iOS";
	return vector<ofSoundDevice>();

So I found that there are some ways to do this job with swift, but it wasn’t really convincing me, since that will have a big overhead for me.(where I might have to deal with several different languages)

I guess that I don’t necessarily need to detect the devices, as the job is to only prevent the audio feedback. So maybe someone knows how to deal with it without knowing the external devices?

Thank you in advance!

Hi, I don’t think that the audio device will change when you plug some headphones. You need to detect if the headphones are plugged in or not. The must be a way, either on ObjectiveC or Swift for achieving such. You can mix ObjC code and C++ but I am not sure if you can do such with Swift and C++.