iPhone 3G refuses to transfer purchased apps to iTunes

My iPhone 3G refuses to transfer purchased apps to iTunes. This is causing me major problems with syncing.

Whenever I attempt to transfer apps from the iPhone to iTunes it goes through the motions, but never actually transfers anything. It displays the various apps in the info area at the top of the screen, but the progress bar never advances.

In comparison when I sync other iPhones, using the same install of iTunes, the progress bar advances and apps are transferred.

The same also happens on clean installs of iTunes on other computers, it seems to be my iPhone that is the common factor. I have tried restoring the phone from a backup, which makes no difference.

This started happening months ago and the phone has since been upgraded to 3.0 and 3.1, but the problem still persists.

Originally it was just a minor irritation, but I made and attempt to fix it which has made things worse. I deleted all the apps from with iTunes and then did "Transfer purchases" in the hope that it might fix something.

It didn't fix anything. Also, I cannot now sync at all.

If I do sync iTunes now does "transferring purchases", fails to transfer and then deletes all the apps (and data) from my iPhone. It also means I can't sync music, podcasts or anything else.

I can't sync anything else, because I can't temporarily turn off app syncing because then iTunes warns that the apps on the iPhone will be deleted.

I also tried de-authorising and re-authorising.

What can I do to get app syncing working again ?

P.S. I have considered deleting all the apps and reinstalling them one by one, in the hope that it will fix the problem. However I don't really want to embark on doing that for 55+ apps and re-entering login details etc for the apps that need them, especially as I might then find out it didn't solve the problem.

Update:

The latest update to iTunes 9 has improved things in one key aspect. If I let a sync run to completion iTunes no longer deletes all the apps from my phone. So I can now sync all my other data, even if I still can't sync my apps.

Resolved:

See my answer to the question for how I finally resolved the problem.


Solution 1:

Well, it looks like I might finally have fixed it without losing all my settings/data. But I warn you, it isn't pretty and it involved temporarily jailbreaking my phone.

First I jailbroke my phone, I used the blackra1n app, but any jailbreaking technique would work equally well.

Then I used cydia to install the OpenSSH package (again any jailbrake package installed would do).

Then I ssh'd into the phone (username = root, password = alpine).

I cd'd into /private/var/mobile/library/safeharbor and took a copy of the directory listing, so I had a note of which apps I had installed. This directory is where all the data for the apps is stored.

I then deleted the file /var/mobile/Library/Caches/com.apple.mobile.installation.plist, this is the file that keeps details of which apps are install. I then rebooted the phone.

At this point the only apps showing as installed were the Apple supplied apps, cydia and blackra1n.

I then backed up the phone. I then restored to the current firmware and let iTunes restore the backup I had just made.

So now I have a clean phone with no apps installed, but importantly I still have the settings and data for the apps I had installed. I have started reinstalling my apps and they are properly picking up their data and settings that are still there in the safeharbor directory.

I have checked that syncing of apps works and am just keeping my fingers crossed that it stays that way.

The important trick here was deleting the com.apple.mobile.installation.plist file, because then iTunes doesn't know that there were any apps installed and so doesn't start deleting the data/settings when it syncs.

Solution 2:

I found a better solution for you:

  1. change the name of the file /var/mobile/Library/Caches/com.apple.mobile.installation.plist, this is the file that keeps details of which apps are install like you said. you can just change to com.apple.mobile.installation2.plist.

  2. the iphone will create a new file almost immediately (maybe you need to start a program like the mail, or itunes)...

  3. after it created the new file. delete it and rename the original "com.apple.mobile.installation2.plist" back to its original name (removed the "2")

  4. don't need to even restart the phone, just open some programs and the setting, the sms app and the safari, the phone will get stuck a bit, as if it is loading something and a few minutes later you will see your apps returned and all is working again. Itunes can update as well. and all the programs setting reappear on the setting page.

Solution 3:

You can eventually attempt to transfer your iPhone apps to your iTunes library via CopyTrans (no jail-breaking needed as far as I know). After the transfer sync your iPhone with iTunes and see whether the issue is now fixed.