iPad fails to sync : unknown error 1140 Recently whenever I try to sync my iPad to my iMac I get the following error message:

27/04/2013 14:34:01.376 AppleMobileDeviceHelper[3815]: 3815:1917989248|AppleMobileDeviceHelper.m:_getDisabledDataClassNamesFromLockdownForTarget| ERROR: Could not find a device with the target identifier d0e43aec963246a826be357c29a086ce8a3c9365. Assuming there are no disabled data classes.


UPDATE
I tried restoring from backup, complete factory restore and re-installing iTunes, same error. I tried syncing with my macbook and it synced without problems

UPDATE
Turning off iPhoto syncing solved the syncing problem, which is a great improvement but I'd like to sync my photos.
Any ideas?
Connect iOS Device
Go to Photos tab in iTunes
Uncheck "Sync Photos from iPhoto" option
Press "Apply" and/or "Sync
Check "Sync Photos from iPhoto" option


Now everything should be as it was before and the error is gone :D