Building an app, iOS 11.0, XCode 9.0, Swift 4.0.
Would like to build an info page, in the past I've used UIWebKit and was able to take advantage of html.
The latest Apple docs recommend WKWebView
I've got it to work with the exception of the mailto://me@example.com//me@example.com mail tag. Would like to stay with Swift 4.0 if possible.
Thank you for ideas or pointers to Tutorials, etc.
Wow, that's kind of disappointing about WKWebView.
Personally I think this a bug not a feature. In-app email, as implemented by the MessageUI framework, is a lot nicer than just bouncing out to Mail. However, if you want to bounce out to mail, you can do that by call
openURL(_:)
on UIApplication (actually it’s successor,
open(_:options:completionHandler:)
).
Can I switch to UIWebView or is that ill advised?
That would be ill advised; while
UIWebView
has not been formally deprecated,
WKWebView
is the future of web views on our platforms.
Tried your code with print statements. Upon clicking the mailto: link, I did not see the print statements. Am I not doing something correctly?
Did you set the navigation delegate on the
WKWebView
? Specifically:
Your view controller should conform to the
protocolWKNavigationDelegate
When your view controller creates the web view, it should set the
property tonavigationDelegate
self
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"