0

Right now I am developing a macOS WebApp, this includes a WKWebview.

However, when I want to upload or download a file, it doesn't work. When I click, nothing happens! Like, nothing. I click on for example on “choose file” or any other upload button, and the window that should appear to select a file or directory doesn’t show up. I have been struggling all day long, checking stackoverflow and many other resources and I found many posts related to my problem, but they are all out-dated.

My code is really simple;

- (void)viewDidLoad {
    [super viewDidLoad];

    // Load the url into the webview
    NSURL *url = [NSURL URLWithString:@"https://www.my-website-url.com"];
    [self.myView loadRequest:[NSURLRequest requestWithURL:url]];
}

So basically all I want is that I can download and upload files to and from my WKWebView.


It is NOT a duplicate question because I still don't get how to implement the code that Willeke is referring to in the comments.

C.Sky
  • 1
  • 1
  • Also, I am not that new with Xcode, but please, if you can, try to explain it in a simple "copy-paste" way. Thanks, again! – C.Sky Nov 10 '18 at 23:57
  • 1
    Re: "it doesn't work", c'mon you can explain a little better than that. Please include details. – l'L'l Nov 10 '18 at 23:59
  • Well, it just doesn’t work. When I click, nothing happens! Like, nothing. I click on for example on “choose file” or any other upload button, and the window that should appear to select a file or directory doesn’t show up. – C.Sky Nov 11 '18 at 00:07
  • Possible duplicate of [How can you get input file to work in a WKWebView?](https://stackoverflow.com/questions/33059687/how-can-you-get-input-file-to-work-in-a-wkwebview) – Willeke Nov 11 '18 at 13:41
  • @Willeke I have seen that post, but I don't get Jeba's answer... I don't understand where to copy paste his code, and how to implement UIDelegate. I cant comment either because I just registered yesterday... – C.Sky Nov 11 '18 at 13:51
  • See [Delegates and Data Sources](https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/DelegatesandDataSources/DelegatesandDataSources.html#//apple_ref/doc/uid/TP40010810-CH11-SW1) and [Input type=file not working in WebView of OS X application](https://stackoverflow.com/questions/42947692/input-type-file-not-working-in-webview-of-os-x-application/42952247#42952247). – Willeke Nov 11 '18 at 14:46

0 Answers0