Also have the same problem with my iMac 5K
I had a macbook and iMac 2010 and this problem didn't occur.
Now i have a 5K iMac since 1,5 month and it connects/disconnects with ALL my iPads ( iPad mini, iPad 3 + iPad air)
But my iphone 5 and 6 are connecting FINE
My devices work fine with my old macbook and old iMac, but when i plug them in my new iMac 5K it keeps bleeping like a maniac and connecting/disconnecting and i get a warning that i should reset all my permissions. I did what anyone else said above these reactions but it didn't work. Also it's not the cable because all my devices work on my older macbook/iMac. Also the iPad 3 and mini/air have different cables ( lightning vs 30 pin)
I think it is the USB port on the computer that doesn't work properly ( i tried ALL USB ports in my new imac without a succes) And it only occurs with my iPads who need more power then my 2 iphones. I think it's the computer