Hard reset your iPhone. When you're having problems like your iPhone randomly shutting off, the first and easiest step to fixing it is usually restarting the phone. In this case, though, you need to use a special kind of restart, called a hard reset.