Search code examples
iosswiftmobilewkwebview

Can I use WKWebView only for an app build?


I am after some advice.

I have created a web app using PHP (HTML, CSS, etc). The coding needed to be server-side to protect the source code. As a web developer, this was what I am used to.

The web application has proved to be popular and I would like to sell within the App Store. WKWebView seems like a quick win and ticks many boxes such as keeping the source code safe / on the server.

Two questions:

  1. Is a complete app using WKWebView only OK / does Apple mind this?
  2. Adding a fallback if there is no signal/service, what is the best method?

Any other ideas/thoughts would be great and help point me in the right direction.


Solution

  • See Apple's App Store Review Guidelines, especially the section: "4.7 HTML5 Games, Bots, etc.". It really depends on the type of app and its functionality.

    I've shipped an app about 2 years ago that was basically just a shell around a WKWebView, that only offered a native settings screen and obtained user location and some device info for analytics. Apple required direct access to the URL of the WKWebView for their review purposes, and held up ship of the app until that was resolved.

    Regarding your second question, if you expect offline usage, you can have a local copy of the JS and HTML5 and other resources needed that you can point your WKWebView to. It sounds like this would defeat your goal of keeping your code secure, however.

    Ultimately, I recommend you provide a REST webservice to a native iOS app. If you're very paranoid about someone somehow reverse-engineering the client native iOS app, then keep the specific compute functions you want kept secure on the server and simply accessed through the REST API. By going native in general, you can give users the UI they truly want and expect, and can much better manage when to go to the server for the bits you require to remain on server. Then it also becomes very clear what functionality and behavior can exist offline too.