Everytime i try to play something on the speaker on my iphone it come up with the message "this accessory is not supported by iphone" than cuts out the speaker and puts my phone into flight mode, nothing is pluged into the iphone when this happens but when it is in its dock it works fine.

What do i need to do to stop it doing this??? Restore it???

Its a unlocked phone by Anysim 1.1.2u .