Carbonate ions also produce a white precipitate with silver nitrate solution. The acid reacts with any carbonate ions present. This removes them, so stopping them giving an incorrect positive ...
Their ions are called halide ions e.g. chloride, Cl-. You can test for them using silver nitrate solution.