Although the Iranians themselves enjoy taking photos of their families, many are not yet used to the sophisticated photographic equipment that foreign tourists like to deploy, and may well regard some of it as highly suspicious, especially zoom lenses. Groups of tourists descending from a bus with their cameras at the ready and shooting off in all directions make policemen particularly nervous.
Avoid photographing airports, naval dockyards, nuclear reactors, roadblocks, military installations, embassies/consulates, prisons, telephone offices or police stations - basically, any government building at all. If in doubt, ask your guide (policemen have been known to forbid pictures being taken in the street, especially in small towns). If you get caught, don't try to be anything except a dumb tourist.
When taking photos of people, particularly of women, ask their permission beforehand - and the answer will usually be no. Exceptions might be made for women photographers. Offering to take pictures of your Iranian friends and post or email to them later is greatly appreciated - as long as you remember to post or email them.
Photography is permitted at most historic sites and even in some museums (without flash) but not around certain holy shrines such as Mashhad and Qom. In imamzadeh (mausoleums of the descendants of Imams) check first with a guardian to make sure that photos are allowed.