Solution-processed perovskite thin films for planar solar cells under ambient conditions