I don't have a major
fruitfly problem, but when they do periodically show up but since I like fresh fruit bht generally hate it when it is refrigerated, they do show up now and again.
I do the following and it works like a charm:
--fill a small jar or a small bown about 1/4 full of vinegar...sprinkle in a little bit of dry yeast, and cover the container with clear plastic wrap with some holes poked into the plastic. They get attracted to this solution, find their way in (through the holes) have their last meal, and can't manage to get out. This has worked quite effectively for me for more than 35 years.
Now if I can only get rid of the groundhogs that are tunneling around my house.
Suggestions are welcome.