hey there!
I had basically the exact same problem for my iPad 3 after purchasing a new MacBook Air yesterday. I kept plugging and unplugging the device which was running version 7.1.2 (i.e. last of iOS7 before iOS8) and the battery icon would flash every 1-3 seconds between charging/not-charging. Restarting the Air did nothing, and neither did restarting the iPad. I just updated the new Air to Yosemite and did the same for my 2011 MacBook Pro. Interestingly, the 2011 Pro was still able to connect perfectly to the iPad and sync. Using that I updated the software on the iPad to the latest version (8.1) and re-tried syncing with the new Air.
This worked!!! Fortunately, no full restoration was required either, and no documents or apps needed to be re-installed. Nevertheless, this proved a headache the entire day and I only just got it sorted! Quite relieved.
If anyone else has the same problem, and don't have the previous sync-able laptop handy, it might work similarly by doing an update from the iPad itself using wifi and the 10W power adapter (although I didn't need to try this, it was an idea in the works!).
Hope this helps someone,
Matt