If your iPhone's battery is almost empty, the flashlight may not work. This is all the more true if the phone is very warm or very cold, conditions that already reduce its proper function. Charge your iPhone, get it down to a moderate temperature, and try again.