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

2/2 UIWebView challenge

hey so i easily did the first section but the second i had some issues so i went to the forum read some stuff and copy and pasted what worked for others. but its not working for me here my code:

UIWebView *webView = [[UIWebView alloc] init];
/* Write your code below this line */
NSURL *url = [NSURL URLWithString:@"http://teamtreehouse.com/"];
[webView loadRequest:urlRequest];
Mike Bronner
Mike Bronner
16,395 Points

Try this:

UIWebView *webView = [[UIWebView alloc] init]; [webView loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString: @"http://team treehouse.com"]];

Hope this helps :)

i got it thanks it

9 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Stefan Buttigieg and Lamar Greene I have modified this challenge to reflect clearly what is required. Please re-take it and let me know if you are still having issues.

Reposted this so that to make sure you got my acknowledgment!

Woohoo :)! Finally completed the iPhone Blog Reader App module! Thank you so much Amit!

Lamar Greene
Lamar Greene
9,581 Points

Thank You! Mine is now working as well!

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Your code was almost right. In the last line you have: [webView loadRequest:urlRequest]; except that the object is called url and not urlRequest.

Jarek Toro
Jarek Toro
3,992 Points

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

this line isn't getting accepted for me for the first part thanks

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

Just pasted that line in the code challenge and it worked for me.

Jarek Toro
Jarek Toro
3,992 Points

yeah i had to refresh the page and it worked thanks!!

Thanks for the lessons in general also i really appreciated it!!!

so I'm having the same trouble. My code for the second part is

[webView loadRequest:url];

is that not right?

so I'm having the same trouble. My code for the second part is

[webView loadRequest:url];

is that not right?

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

That looks right. Did it not work?

Finally got it. It did work! Can't remember what the problem was now, but that essentially worked.

Somehow here the code still not working. Any help would be appreciated!

Lamar Greene
Lamar Greene
9,581 Points

I tried the above for challenge 2,

[webView loadRequest:url];

and I cannot get my code to pass...

It would be really great if a solution is found because this is preventing me from finishing this course :( !

Basically [webView loadRequest:url];

is not working :( ! Thanks in advance for your help!

Woohoo :)! Finally completed the iPhone Blog Reader App module! Thank you so much Amit!

Tobias Mahnert
Tobias Mahnert
89,413 Points

Code does not work. Whats wrong?

UIWebView *webView = [[UIWebView alloc] init];

/* Write your code below this line */

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

NSURL *urlRequest = [NSURLRequest requestWithURL:url];

[webView loadRequest:urlRequest];

Brett Kim
Brett Kim
11,576 Points

Same, my [webView loadRequest:urlRequest]; for some reason isn't working. Stefan Buttigieg and Amit Bijlani , do you know why the compiler does not accept?

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

I know this is an old post, but the code below did not work on the 3rd part of the challenge.

[webView loadRequest:url];
Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

Ummm, never mind; it worked when I changed it to:

[webView loadRequest:urlRequest];