pH-dependent selective ion exchange based on (ethylenediamintetraacetic acid-nickel)-layered double hydroxide to catalyze the polymerization of aniline for detection of Cu2+ and Fe3.