If you have a fruit fly problem there are ways to get rid of them. You should find and get rid of their breeding sites. The flies enter homes on the damaged areas of over ripe fruits and vegetables, so get rid of food that is starting to rot. Clean other areas where the flies could be breeding, such as beneath the garbage disposal, in the bottom of the trash can, or in unwashed cans and bottles.
You can make a fruit fly trap by placing a funnel in a jar and pouring in a few tablespoons of cider vinegar. The flies will fly in but they won't find their way out.
You should cut off all of the damaged areas on fruits and vegetables as s soon as you get home and put what you can in the refrigerator because fruit flies can't survive in cold temperatures. Any fruits that can't be refrigerated should be placed in a loosely covered bowl.