Crash when Adding a WebView to a Multiview Tab Bar App
I am new to this and working thru a "teach yourself book". I have two questions. How to trouble-shoot this in the future and how to get the darn thing to work now.
I have a simple three Tab Bar app that points to three UIViewController. The three views work fine until I add a Webview to one of the XIBs. As soon as I bring up the view with the WebView included in the simulator, I am kicked out of the App.
The Debugger console says"'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key bannerView.'" I don't know what that means.
.h file code....
@interface ConvNavController : UIViewController { IBOutlet UIWebView *bannerView; } -(IBAction)loadbannerView:(id)sender;
@property (nonatomic, retain)IBOutlet UIWebView *bannerView;
========= .m file code -(IBAction)loadbannerView:(id)sender{
NSURL *bannerURL;
NSString *bannerURLString;
bannerURLString=[[NSString alloc] initWithString:@"http://www.tak2000.com/banner_test.html"];
bannerURL =[[NSURL alloc] initWithString:bannerURLString];
[bannerView loadRequest:[NSURLRequest requestWithURL:bannerURL]];
[bannerURL release];
[bannerURLString release];
}
I used a simple button connected to loadbannerView.
Webview code worked great in a simple one view example. Why is it dying when I use it in multi UIViewController app? BTW: I used开发者_开发技巧 the "Windows Based App" template as a starting point. I also ensured the Class Identity was UIWebView.
Thanks in advance...
bannerView is a property, so it should be
[self.bannerView loadRequest ....]
and make sure in interface builder that you've connected your UIWebView
to the bannerView
outlet.
精彩评论