问题描述
尝试在iOS中显示网页,但在实施WKWebkit时遇到问题。
ViewController.h
@import WebKit;
@interface ViewController : BaseViewController
@property (retain,nonatomic) WKWebView *webView;
@end
ViewController.m
@interface ViewController ()
@property (strong,nonatomic) IBOutlet UIView *containerView;
@property (strong,nonatomic) IBOutlet NSLayoutConstraint *fieldViewBottomConstraintY;
@property (strong,nonatomic) IBOutlet NSLayoutConstraint *centerCredentialsConstraintY;
@end
@implementation ViewController
@synthesize webView;
-(void) viewDidLoad {
[super viewDidLoad];
webView = [[WKWebView alloc] initWithFrame:[[self view] bounds]];
NSURL *url = [NSURL URLWithString:@"https://www.google.com"];
NSURLRequest *urlReq = [NSURLRequest requestWithURL:url];
[webView loadRequest:urlReq];
[self.view addSubview:webView];
[self setupConfiguration];
// Do any additional setup after loading the view.
}
@end
我收到此错误:
Class Unavailable: WKWebView before iOS 11.0 (NSCoding support was broken in prevIoUs versions)
我知道这个问题不是很集中,但是我的时间表很紧迫,仍然无法掌握Objective-C和iOS,而且我还没有找到很多可行的解决方案,因此我需要解决这个问题。感谢提供的任何帮助。