How to switch between iOS app and Setting screen and come back from Settings screen to Recent app screen

Hello,

I have one scenario to test, Sharing articles with facebook and twitter, To do that I have to log in to facebook and twitter from settings page. How to switch from current app to iOS Settings screen and log in there with facebook and twitter and switch back to my app. How can I automate this scenario? Please help me.

Regards,
Sumit