Hype 3 -> Xcode -> Swift 3 -> UIWebView?


(joe) #1

Hi,

I’m doing an iOS app for app using Hype 3. I could load the file but the page is blank:

I tested the html on Safari and it worked fine as followed:

I try deleting the file references rom Xcode and re adding them:

here are the codes in Xcode:


(Jonathan Deutsch) #2

The documentation states that UIWebView’s loadRequest shouldn’t be used for local HTML files and to instead use the loadHTMLString method.

Another culprit could be that you did not connect the IBOutlet in the webView.

Also I (along with Apple!) recommend using a WKWebView (with loadFileURL) instead of a UIWebView. Exported Hype document performance is better in WKWebViews.


(joe) #3

Is there a step by step tutorial for WKWebView (with loadFileURL) that you can point me to?


(Carolyn) #4

Joe, I imagine that you’ve found a solution, but for posterity, I had the same issue. As Jonathon mentioned, make sure that the webview is connected to the code, as shown in Nick’s tutorial: The Hype to Swift 3.0 Tutorial Series is Finished!

But having done that, I was still seeing a blank screen. So I re-exported the Hype project, deleted the older content that wasn’t working from then reimported new into my Xcode project, and things suddenly started working. Not sure what the issue was and I’m still having a problem with an older Xcode project that was working, but for the moment, all the matters is that I can make something work now.