title: UIWebView and WKWebView
body: <p>I want to use WKWebView for IOS8 but also need compatibility for IOS7, I have seen the posts referring to using this code:</p>
  
  <pre><code>if ([WKWebView class]) {
  // do new webview stuff
  }
  else {
  // do old webview stuff
  }
  </code></pre>
  
  <p>But not sure what I am doing wrong as the code below gives me a linker error:</p>
  
  <pre><code>Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_WKWebView", referenced from:
    objc-class-ref in ViewController.o
  ld: symbol(s) not found for architecture i386
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Any help much appreciated, here is my code:</p>
  
  <p>.h file:</p>
  
  <pre><code>#import "WebKit/WebKit.h"
  #import &lt;UIKit/UIKit.h&gt;
  @interface ViewController : UIViewController
  
  @property (weak, nonatomic) IBOutlet UIWebView *contentWebView;
  @property (weak, nonatomic) IBOutlet WKWebView *contentWKWebView;
  
  @end
  </code></pre>
  
  <p>.m file:</p>
  
  <pre><code>#import "ViewController.h"
  
  @interface ViewController ()
  @end
  
  @implementation ViewController
  @synthesize contentWebView;
  @synthesize contentWKWebView;
  
  - (void)viewDidLoad {
  [super viewDidLoad];
  
  NSString *filePath = [[NSBundle mainBundle]pathForResource:@"LockBackground" ofType:@"html"];
  NSURL * fileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];
  NSURLRequest * myNSURLRequest = [[NSURLRequest alloc]initWithURL:fileURL];
  if ([WKWebView class]) {
      [contentWKWebView loadRequest:myNSURLRequest];
  } else {
      [contentWebView loadRequest:myNSURLRequest];
  }
  }
  
  -(UIStatusBarStyle)preferredStatusBarStyle {
  return UIStatusBarStyleLightContent;
  }
  
  - (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
  }
  
  @end
  </code></pre>