简体   繁体   中英

Undeclared Identifier 'webview'

I am building a tab bar application with a different pdf in each tab. I have two sets of view controllers. Each have this relative code

#import "SecondViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSString *path = [[NSBundle mainBundle] pathForResource:@"Winter_Newsletter"
                                                     ofType:@"pdf"];
    NSURL *url = [NSURL fileURLWithPath:path];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webView loadRequest:request];
    [webview setScalesPageToFit:YES];    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

I keep receiving an error "undeclared identifier 'web view'" What am I doing Wrong?

You are showing in the code two versions of webView( capital V ) and webview( small v )

[webView loadRequest:request];
[webview setScalesPageToFit:YES];    

And if you are using auto-synthesize then it sould be

self.webView or _webView

而且,不要忘记为Web视图添加属性并控制拖动以将其连接起来!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM