Zahra04,
Hmm, your symptoms seem to fit the issue of a bad WiFi connection. You said that Safari still works. Is it possible that it it using cellular data instead of WiFi?
Anyway, I guess that the first thing to do is a restart if you have not already done that.
Then double check your WiFi:
If your iPhone, iPad, or iPod touch won’t connect to a Wi-Fi network
Let us know if you get it going. Good luck.