[WKWebView takeSnapshotWithConfiguration:completionHandler:] function does not work

- (void)viewDidLoad {
    [super viewDidLoad];
    UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(rightButtonTapped:)];
    self.navigationItem.rightBarButtonItem = rightButton;
    
    WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
    _webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:configuration];
    _webView.navigationDelegate = self;
    [self.view addSubview:_webView];
    
    NSURL *url = [NSURL URLWithString:@"https://www.apple.com"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [_webView loadRequest:request];
}

- (void)rightButtonTapped:(UIBarButtonItem *)sender {
    NSLog(@"self.webView.scrollView.contentSize.height:%f", self.webView.scrollView.contentSize.height);
    
    WKSnapshotConfiguration* configuration = [WKSnapshotConfiguration new];
    configuration.rect = CGRectMake(0, 0, self.webView.scrollView.contentSize.width, self.webView.scrollView.contentSize.height);
//    configuration.afterScreenUpdates = NO;
    [self.webView takeSnapshotWithConfiguration:configuration completionHandler:^(UIImage * _Nullable snapshotImage, NSError * _Nullable error) {
        if (error) {
            NSLog(@"fail");
        } else {
            NSLog(@"succ");
        }
    }];
}

Running the code above, I get a blank image

[WKWebView takeSnapshotWithConfiguration:completionHandler:] function does not work
 
 
Q