Is there an existing feedback elimination algorithm that can be implemented in iOS?
I've never implemented this myself, but here are my (possibly incorrect) thoughts:

The general method of feedback elimination is to


Detect the frequencies that are feeding back
Tune a filter to eliminate those frequencies


Step 2. is relatively easy, especially if you are using iOS and have an audio unit that can do it for you. There are some things to watch out for -- because you need a fairly steep filter you need to make sure it is stable even at extreme settings -- but hopefully the folks at Apple have taken care of that stuff for you.

Step 1. is trickier -- how do you know something is feedback and not a genuine part of the audio? There are some advanced techniques related to echo cancellation and adaptive filtering for doing this, but I'm not aware of anything widely available as code or libraries. There might be some shortcuts for your specific use-case, e.g. If you are dealing with speech only, you might be able to simply track pitch, and if a single pitch is strong enough assume that it's a result of feedback, but even doing that quickly enough may not be trivial.

Note that this entire process usually needs to be done continuously/adaptively, at least to some extent to make sure movements of the mike and speaker don't cause new feedback.

There are several patents associated with this, mostly because it's an important aspect of designing hearing-aids. Perhaps some of them are expired and you use them:


https://patents.google.com/patent/US4783818A/en?q=method&amp;q=of&amp;q=and&amp;q=means&amp;q=for&amp;q=adaptively&amp;q=filtering&amp;q=screeching+noise&amp;q=caused&amp;q=by&amp;q=acoustic+feedback
https://patents.google.com/patent/US4677677A/en?q=acoustic+feedback&amp;q=cancelation&amp;page=1


(Note, wikipedia mentions another method based on pitch shifting. I'm not familiar with this, and it sounds pretty silly, but it might be worth investigating.)