Fruit flies are not attracted by fresh fruit, they like rotten ones because in this case the process of fermentation is already started. For the same reason, they like juices, wines, and other sweet liquids. Don’t buy infected or overripe fruit and try to wash fruits immediately and store them under cover or in batches. If flies still bred, and you can’t get rid of them by yourself, you have to apply more serious fruit flies control methods.