Objective c -(BOOL)webview:donds';t在目标c xcode中运行

Objective c -(BOOL)webview:donds';t在目标c xcode中运行,objective-c,webview,Objective C,Webview,我正在试着让它运行。。。我已经输入了nslog,但当我更改页面时,调试器中没有显示任何内容 这是我的密码: #import "ViewController.h" @interface ViewController () @end @implementation ViewController @synthesize webview; - (void)viewDidLoad { [super viewDidLoad]; self.webview.delegate = self

我正在试着让它运行。。。我已经输入了nslog,但当我更改页面时,调试器中没有显示任何内容

这是我的密码:

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
@synthesize webview;

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.webview.delegate = self;
    NSString *path = [[NSBundle mainBundle] pathForResource:@"menu" ofType:@"html"     inDirectory:@"pages"];
    NSURL *url = [NSURL fileURLWithPath:path];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];

    [self.webview loadRequest:request];
    NSLog(@"%@",[[request URL] absoluteString]); //this log appears when the ipad simulator starts
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
下面的此部分似乎未运行(调试器中未显示日志!)


检查委托方法的大小写;应该是:

- (BOOL)webView:(UIWebView*)aWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType

i、 e.
webView
,而不是
webView

我看到您分配了代理,但是您是否也在界面中包含了协议名称?以下是.h文件中的代码:“#导入”@interface ViewController:UIViewController{”IBOutlet UIWebView*webView;}@property(非原子,保留)UIWebView*webview@这就是你的意思吗?很抱歉,我的格式是新的,请确保webview连接正确。将其添加到
viewDidLoad
的顶部:
NSLog(@“webview=%@”,self.webview)。我不喜欢您对实例变量和属性使用相同的名称(
webview
);事实上,您可以删除实例变量,因为
clang
将在这些天为您自动创建该变量。当我添加该代码时,它会输出:webview=我认为您的头看起来不错。从这里看不到任何错误,但@trojanfoe是对的。您应该重命名/删除实例变量。@smj2393是的,很容易出错。
- (BOOL)webView:(UIWebView*)aWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType