Accessory not supported? Iphone?

I charge my phone a lot and a lot of times, a window pops up that says "accessory not supported". I have had my iPhone 5C since February. Why is this happening? Is it the phone or charger. I'm using the original charger that came with the phone from att.

Its possible the charger is frayed and so it only works when placed in a certain direction