Chosen Solution
So alike to my 5s, my iphone 5 is having the exact same problem (batt died, didn’t change it till about halve a year later), its shutting down by itself when not in use, what’s different is that there are lots of panic code in the diagnostic. Problem: Phone keeps shutting down when not in use, changing battery doesn’t solve the problem. Question: Which IC is broken? Or what else could it be? PS. Reset, restore did nothing, also tried removing the proximity.
Power management IC no doubt. U2 Tristar Charging IC does not cause this.
Before you go into the motherboard troubleshooting I would suggest that you charge the battery up to 100%, open up the phone, disconnect the charging port and proximity sensor and see if it still shuts off. If the problem is gone then re-connect the parts one by one until the problem re-occurs.
My iPhone switches off when I lock it or when it’s go to sleep mode and for me to use it the screen must be on all the time please help
i would send it to the store you got it from and see if they can do anything about