A yellow precipitate is formed when silver nitrate solution, acidified with dilute nitric acid

(Talk about needing to memorise colour tests for base metals and tests for Halides) The compound is KI (potassium Iodide) because potassium compounds burn with a lilac flame, and production a pale yellow precipitate show the formation of Iodide ions. *(mention ammonia test to see if the precipitate dissolves, which it won't to distinguish from Bromide)

You can see that the compounds are all pretty insoluble, but become even less soluble as you go from the chloride to the bromide to the iodide.

What is the ammonia doing?

The ammonia combines with silver ions to produce a complex ion called the diamminesilver(I) ion, [Ag(NH3)2]+. This is a reversible reaction, but the complex is very stable, and the position of equilibrium lies well to the right.

A yellow precipitate is formed when silver nitrate solution, acidified with dilute nitric acid

A solution in contact with one of the silver halide precipitates will contain a very small concentration of dissolved silver ions. The effect of adding the ammonia is to lower this concentration still further.

What happens if you multiply this new silver ion concentration by the halide ion concentration? If the answer is less than the solubility product, the precipitate will dissolve.

That happens with the silver chloride, and with the silver bromide if concentrated ammonia is used. The more concentrated ammonia tips the equilibrium even further to the right, lowering the silver ion concentration even more.

The silver iodide is so insoluble that the ammonia won't lower the silver ion concentration enough for the precipitate to dissolve.

An alternative test using concentrated sulphuric acid

If you add concentrated sulphuric acid to a solid sample of one of the halides you get these results: