S.B.
I just had this question and a friend of mine told me to put some apple vinegar in a mason jar and poke holes in the lid. The fruit flies fly in but can't get out - this has solved my problem. I did not have a mason jar so you can use an empty spice jar with one of those plastic lids with holes.