You have been invaded by the tomato pinworm, Keiferia lycopersicella (Walsingham). They usually do not damage all fruit and can be controlled only by a preventive insecticide spray every seven to 10 days. When the damage is evident, it is too late to do anything about it.
Contact your local Extension office for a list of recommended insecticides.