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 Build a Blog Reader iPhone App Viewing a Web Page Opening a Web Page in Safari

Viewing a webpage

Challenge task 1 of 1

Open the 'url' object within the default browser using UIApplication.

NSURL *url = [NSURL URLWithString:@"http://teamtreehouse.com"];
UIApplication *application = [UIApplication sharedApplication];
/* Write your code below this line */

[application openURL:@"http://teamtreehouse.com"];

Bummer! Make sure you created an application with the correct method, and check your syntax!

3 Answers

You are supposed to pass the url object as the parameter to the openURL method, not a string literal.

Sorry, I'm not getting it. So how does the code look like?

NSURL *url = [NSURL URLWithString:@"http://teamtreehouse.com"];
UIApplication *application = [UIApplication sharedApplication];
/* Write your code below this line */

[application openURL:url];

Woah. Thanks bud