If iTunes is giving you “error 4005” or “error 4013” then it’s most likely a hardware issue. However, you did not mention what error you were getting, if any so I’ll give you a few options that may work.
1. Try entering DFU mode and restoring with iTunes.
- Try using another cable or another PC.
- Try a tool like Dr Phone or iSkysoftrecovery.
- (Assuming none of these have worked)…
- Try replacing the battery. (A faulty battery is quite common in a case like this).
- try removing the LCD and re-attempt to restore using iTunes. If your iPhone successfully restores without the LCD, then you’ll know that you need to replace the LCD.
- Replace the proximity sensor, a faulty proximity sensor is not as common as a faulty battery, however it still could be the problem.
- (If any of these worked, congratulations. If not, there’s still a few more options. But bear in mind, what I’m about to mention is not for beginners and requires some technical skills.)
- If none of the above worked, then your problem will most likely be corrupt firmware, or issues on the compass IC. You might be dealing with a cold joint under the NAND which would require you to use a SMD rework station to reball the chip. However, reballing the chip is not easy at all and is only a temporary fix, as in your iPhone will work for about a month to a month and a half, two months MAX before it needs to be reballed again. Replacing the logic board itself would be an easier option if the fault lies on the logic board, however you must remember that the logic board of the iPhone IS THE IPHONE so if you somehow manage to get another logic board, it would’ve come from another iPhone of which you have no knowledge of its history, so there’s a risk of ending up with a faulty logic board therefore you’ll be back to square 1. Assuming you get a functioning logic board, I personally wouldn’t recommend it as the cost to replace the logic board will be more or less the same as the value of the iPhone itself so at this point you’d might as well look at purchasing a new iPhone.
I hope it’s a minor fix and doesn’t require severe technical work. Best of luck!