I can verify the same problem on iOS 12 beta 9, in detail:
- set customUserAgent the FIRST time on any WkWebView is not working
- set customUserAgent any time after the FIRST time it's working properly
In case someone else stumbles across this: I had the same issue. Set userAgent via UserDefaults, on WKWebView and on the request itself. Nothing worked on the first request, but all subsequent requests where fine. Turns out that the first request resulted in a redirect (https://www.foo.com => https://foo.com) and the custom userAgent was not sent. Once code was updated to go directly to the site without www it works as expected.