Re: How to present a web view while supporting 10.9?


John Brownie
 

Thanks for the reply.

Sandor Szatmari wrote on 6/2/20 20:51:
What SDK are you building against?
I assuming deployment target of 10.9 and not earlier…
I'm still on 10.14.6, Xcode 11.0, current SDK, which I assume is 10.14 (I can't see an option to choose anything but a platform in the SDK pop-up).
What is the exact problem your having? Is it just warnings, or are there compile/link/runtime errors…
I create a window in IB, and add a WKWebView to fill the content view. I then create an outlet to that, and Xcode wants me to mark the whole class (in Swift) as being available in 10.10 or later, and that's an error, not a warning. So there is a problem with what I do if I'm running on 10.9. Maybe I should just do it in Objective-C instead?

I have done this before with API available only on some platforms, but it's the first time I've run across it in a view built with IB. It's probably something quite simple, but I haven't been able to find an answer.
I just set the deployment target of an app with a WKWebView to 10.9 and build SDK 10.14. I got warnings of WKWebview et. all… not being available on 10.9 but it compiled and ran fine on Mojave. I’m assuming the availability conditionals would allow selection of WebView code if I ran it on some earlier release.
Not having the luxury of more than my own computer to test on, I can't tell what would happen if I did that and ran on 10.9. I'm still in the design/coding phase of this particular item.
I added a reference to a plain WebView and it did not complain about that with the deployment target set to 10.9.
With all the dire warnings about not using WebView, I'd much rather aim for WKWebView if possible. And this is only for a maintenance release, so I don't want to change the deployment target to 10.10 just for this.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland

Join cocoa@apple-dev.groups.io to automatically receive all group messages.