Why Did My Iphone Reset Itself To Factory Settings. When your location and privacy settings are reset apps will stop using your location until you grant them permission. If you would like to reset all of your location settings to the factory default go to Settings General Reset and tap Reset Location Privacy.

Then release the button and let your iPhone start as usual. Also if its set up the same way as my phone theres a box that says to back up your content. Turning it off will fix the problem.
Step 2 Log into your iCloud account and restore your iPhone.
As uTheKillOrdermentioned your phone was probably near full and iOS devices doesnt handle that very well. Then release the button and let your iPhone start as usual. If you didnt already you should check the box. The iPhone Wiped Itself may happen because of battery issues.
