Can't log into facebook on iphone 5?

Whenever I try to log in it keeps coming up with the error message: nsurlerrordomain error 1012, this is happening with twitter and instagram too, I'm 100% certain that I'm entering the right usernames and passwords and I have full access to the internet as safari works! What is going on, how can I fix this?: Help ME

These errors may indicate a hardware issue with your device.
BUT try this: sign out from other devices or pc before logging in on your iphone 5