iPhone problems

Jan 30, 2011
My iPhone 3GS keeps on telling me that this accessory is not optimized for this device when I put my headphones on. Then I don't get any sound so I have to pull it out and put it back in. It even says it when I have it charging or just sitting there. When u lock the screen its supposed to click well it only does it when the headphone are plugged in, and when u plug it into the charger it's supposed to make that chime like noise but it doesn't do that either only if the headphones are in. Have no idea what wrong with it. Any ideas?