Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

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

The problem is to open the 'url' object within the default browser using UIApplication and here is the code. This is what I have so far.

NSURL *url = [NSURL URLWithString:@"http://teamtreehouse.com"];

UIApplication *application = [UIApplication sharedApplication];

/* Write your code below this line */

[application openURL:blogPost.url];

The error says I'm using the wrong method if so which method should I be using?

2 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

There is no blogPost object in the code challenge. You have a local variable named url declared on the very first line which is what you should use: [application openURL:url];

Thanks it worked.

Robert Uhler
Robert Uhler
3,637 Points

Your NSURL is stored as "url" not "blogPost.url" try changing "blogPost.url" to "url" and it should work.