in demo ,load index.html into WKWebView, when i click file button, the camera page present and then dismiss quickly
ViewController.h
@property (nonatomic, strong) WKWebView *wkWebView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
WKWebViewConfiguration *configuration = [WKWebViewConfiguration new];
self.wkWebView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 400, 300) configuration:configuration];
NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"];
[self.wkWebView loadFileURL:url allowingReadAccessToURL:[[NSBundle mainBundle] bundleURL]];
self.wkWebView.backgroundColor = [UIColor blueColor];
[self.view addSubview:self.wkWebView];
}
index. html
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<div>
<label style="font-size: 40px;">open camera</label>
<input type="file" accept="image/*" capture="camera" id="file-input" class="file-input">
</div>
</body>
</html>