The main cause of maggot damage in apples and pears is the caterpillar of the Codling Moth. This pest is very difficult to control with insecticides unless applied shortly after egg-laying.
Hang this trap in the garden in early May until August to help monitor if Codling Moths are present.
The Pheromone scent of the female Moth will attract male Moths to the trap, if you are catching more than 15 Moths per week a suitable spray should be applied.