Aims. Chemical evolution models are useful for understanding the formation and evolution of stars and galaxies. Model predictions will be more robust when more observational constraints are used. We present chemical evolution models for the dwarf irregular galaxy NGC 6822 using chemical abundances of old and young planetary nebulae (PNe) and H ii regions as observational constraints. We use two sets of chemical abundances, one derived from collisionally excited lines (CELs) and one from recombination lines (RLs). We use our models as a tool to distinguish between both procedures for abundance determinations. Methods. In our chemical evolution code the chemical contribution of low and intermediate mass stars is time-delayed, while for the massive stars the chemical contribution follows the instantaneous recycling approximation. Our models have two main free parameters: the mass-loss rate of a well-mixed outflow and the upper mass limit, M up , of the initial mass function (IMF). To reproduce the gaseous mass and the present-day O/H value we need to vary the outflow rate and the M up value. Results. We calculate two models with different M up values that reproduce the constraints adequately. The abundances of old PNe agree with our models and support the star-formation history derived independently from photometric data. Both require an early wellmixed wind, lasting 5.3 Gyr, to reproduce the observed gaseous mass in the galaxy. In addition, by assuming a fraction of binaries producing SNIa of 1%, the models fit the Fe/H abundance ratio as derived from A supergiants. The first model (M4C), which assumes M up = 40 M , fits within errors smaller than 2σ the O/H, Ne/H, S/H, Ar/H and Cl/H abundances obtained from CELs for old and young PNe and H ii regions. The second model (M1R), which adopts M up = 80 M , reproduces within 2σ errors the O/H, C/H, Ne/H and S/H abundances adopted from RLs. Both models reproduce the increase of the O, Ne, S, and Ar elements during the last 6 Gyr. We are not able to match the observed N/O ratios in either case, which suggests that the N yields of LIMS need to be improved. Model M1R does not provide a good fit to the Cl/H and Ar/H ratios, because the SN yields of those elements for m > 40 M are not adequate and need to be improved (two sets of yields were tried). From these results we are unable to conclude which set of abundances (the one from CELs or the one from RLS) represents the real abundances in the ISM better. We discuss the predicted ΔY/ΔO values, finding that the value from model M1R agrees better with data for other galaxies from the literature than the value from model M4C.