About a few weeks ago my iPhone began to randomly rebooting, as I pondered over the problem and the solution this is what I came across.
What is the Problem?
While trying to upgrade your iPhone software have you encountered the error message: The iPhone “-” could not be restored. An unknown error occurred (29).
iPhone Error 29 primarily affects users who have replaced a hardware component like batteries, and this means that iOS might be triggering some compatibility issue with the aftermarket
Enabling recovery mode
Step 1: Disconnect the USB cable from your iPhone, but leave the other end of the cable connected to your PC’USB port.
Step 2: Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to turn off.
If you cannot turn off the device using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the device turns off, simply release the Sleep/Wake and Home buttons.
Step 3: While pressing and holding the Home button, reconnect the USB cable to the device. The device should turn on.
Note: If you see battery pictured on the screen, let the device charge for at least ten minutes to ensure that the battery has some charge, and then start again with second step.
Step 4: Continue holding the Home button until you “Connect to iTunes” message flashes on the phone’s screen.
If necessary, open iTunes and you should be able see the recovery mode
Step 1: Show hidden files under your folder options.
Step 2: Close the iTunes and disconnect your iPhone from the PC.
Step 3: Navigate to the following directory:
Win 7 & Vista Users:
C:Users\*UsersName*\AppData\Roaming\Apple Computer\iTunes\Device Support
C:\Documents and Settings\*UserName*\Application Data\Apple Computer\iTunes\Device Support or iPhone Software Updates
Step 4: Backup the files available in the folder and delete them from that folder.
Step 5: Put your iPhone into Recovery Mode and Restore the Custom firmware.
This is also a quite general solution for most of the iPhone problems with “can not restore errors”.