Some recipes use flour and others cornstarch or even both. It's a matter of preference. Cornstarch makes a glossy filling and flour creates a more cloudy filling. Both need to be cooked to thicken and cornstarch requires higher heat than flour to thicken.
Flour works better with less juicy fruit like apples. The first time you make a recipe, it's best to follow its recommendation.