Lead halide perovskites can be turned into optoelectronic devices through low-cost solution depositions, but these approaches often leave numerous charge-trapping defects in the perovskite.