Several readers have reported an issue where the iPhone displays the message "This accessory is not made to work with iPhone" when it is docked or simply connected to a host computer; or when nothing is connected to the iPhone's dock connector. In other words, no accessory is connected to the iPhone, but it displays the accessory incompatibility indicator anyway.
This Apple Discussions thread harbors some relevant posts, including:
"I get the accessory message even when the phone is in my hand with nothing hooked up (no headphones, no dock cable or connector) just the phone."
"(My iPhone) started randomly displaying the accessory message every few minutes a few days ago, even when nothing is attached to the phone (in fact, it seems to happen more often when nothing is attached as opposed to when the earbuds or the dock are attached)."
In many cases, the fix for this issue is to simply restore the iPhone using iTunes. Connect your iPhone to your computer, then in iTunes, select your iPhone and click the Restore button under the Summary tab. Restoring the phone will erase contacts, calendars, photos and other data on the phone, but will restore automatically backed-up information including text messages, notes, call history, contact favorites, sound settings, widget settings, etc.