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 Implementing a UIWebView

Adam Berkowitz
Adam Berkowitz
2,673 Points

Trouble with UIWebView and IBOutlet

I'm working through the blog reader project and have run into a problem. For some reason when I control/click on UIWebView in mainStoryboard.storyboard and drag the blue line to webController.h, nothing happens. No IBOutlet is created, no dialog is created, nothing. Does anyone know why this might be happening?

Adam Berkowitz
Adam Berkowitz
2,673 Points

I went back one video to try to replicate exactly what's happening and now I have a different problem! I created the custom class "WebViewController" exactly like Amit does in the video. I my UIViewController to the same name. But now, when I try to drag UIWebView onto it, XCode rejects what I'm trying to do... Clearly something is wrong, but I have no idea what.

4 Answers

Enara L. Otaegi
Enara L. Otaegi
13,107 Points

Have you set your custom class on the identity inspector?

Patrick Donahue
Patrick Donahue
9,523 Points

That is a good answer. I have been there more than once!

Adam Berkowitz
Adam Berkowitz
2,673 Points

I must have missed that step. I'll go back and check how to do it. Right now, in the identity inspector (under the custom class heading), it just says "Class" and the dropdown says "UIWebView".

Enara L. Otaegi
Enara L. Otaegi
13,107 Points

Sometimes the dropdown doesn't show your classes, just type webController if that is your class name.

Adam Berkowitz
Adam Berkowitz
2,673 Points

Something's still not right. When I type in the name of the custom class "webViewController" I just get an error sound/beep and I still can't create the IBOutlet. I suppose I will try adding it programmatically and see if that works.

Enara L. Otaegi
Enara L. Otaegi
13,107 Points

That's weird. Usually when I get that beep error sound it's because the class doesn't exist or doesn't match the object I have in the storyboard.

Adam Berkowitz
Adam Berkowitz
2,673 Points

Ok - I think I solved the problem. It seems I was selecting/renaming the UIView instead of UIViewController. When I went into the mainStoryboard hierarchy and selected UIViewController manually (instead of clicking in the storyboard) I was able to rename it to WebViewController. Then I could ctrl/drag the blue line into WebViewController.h normally.

Thank you both so much for the help!

Patrick Donahue
Patrick Donahue
9,523 Points

Good job! Glad you were able to figure it out!

Enara L. Otaegi
Enara L. Otaegi
13,107 Points

Good job! Happy to see you solved it :D

Patrick Donahue
Patrick Donahue
9,523 Points

"... exactly like Amit does in the video. I my UIViewController to the same name. "

You created the same file name? That would be an issue.

Enara L. Otaegi
Enara L. Otaegi
13,107 Points

Can you post the code from your WebViewController.h?