Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

How do you send an authenticated GET request to a URL and get an HTML response in an iOS Swift app?

I'm trying to build an iOS Swift app. I would like to be able to login to Facebook and send a request to a URL and get the raw HTML in return. I have started using the Facebook Login API and got that working successfully. I have also used a library called Alamofire that allows you to send HTTP requests(not sure if I'm explaining this properly) to a URL and the HTML is returned. What I would like to do is either use the Facebook Login API or any other method to authenticate and send a GET request to a Facebook URL. Currently, when I try this, I get the HTML back as a String, but I'm not logged-in and the HTML is that of a logged-out user. I've also tried modifying the code from Pasan Premaratne's Swift videos Network Operations and Methods with Closures.

Any help on this and I'll love you forever!!