I'm pretty new to Objective-C/iOS Dev as a whole and am going grey over this. I can not seem to get WKWebkit working for the life of me.
After extensive Google Searches, I finally put together some code that compiles - buuuut the app crashes.
WebView.h
#import <UIKit/UIKit.h>
#import <Webkit/Webkit.h>
#import <objc/runtime.h>
@interface WebViewController: UIViewController <WKUIDelegate>;
@property (nonatomic, strong) WKWebView *webView
@end
WebView.m
@implementation WebViewController
-(void) viewDidLoad {
[super viewDidLoad];
if (NSClassFromString(@"WKWebView")) {
_webView = [[WKWebView alloc] initWithFrame:[[self view] bounds]];
} else {
_webView = [[UIWebView alloc] initWithFrame:[[self view] bounds]];
}
NSString *urlString = @"http://www.google.com";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[_webView loadRequest:urlRequest];
}
@end
I do have the class set as WebViewController under custom class in the storyboard, as well.
Here is the error message I keep getting:
[WebViewController superview]: unrecognized selector sent to instance 0x7fdbb570e050
Any clue what I'm doing wrong? I'm still too unfamiliar to catch any obvious bugs myself. Thank you so much!