Erasing all data on your iPhone does just what it sounds like: It erases everything stored in the iPhone memory, including text messages marked for deletion. It deletes your music, email, apps, and everything else, too. The same is true when you restore the iPhone to factory settings.