Can we support offline Single Page web apps in iOS 10+? - ios

We are developing a Single Page RWD web app which supports all mobile form factors. We would like to
have the webapp support offline browsing capability as well
Once the data is downloaded from server, user should be able to see that data even if there is no internet connection.
Users should be able to fill forms, and later submit it to server, when there is internet connection.
Can we use the AppCache, HTML5 storage to get the offline capabilities? If we are using hash to change the navigation in address bar the whole page refresh problem is also not there.
Was going through some of the older posts in Stackoverflow on this. Offline iOS web app: loads my manifest, but doesn't work offline
This post is dated back in 2011. In 2017, can we support

If you want to open something from an URL to the webView, you need internet. You can do the following thing in the iOS application with certain conditions.
Users should be able to fill forms, and later submit it to the server, when there is an internet connection.

You need to cache all the responses when using the native iOS or any other cross platform. If you are wondering about PWA, it is coming in the 11.3 version of iOS. Refer this link to understand more about the service workers in the WebKit. It is a beta version, so do not expect it to run bug free.

Related

Record audio in mobile Safari

I need to create an iOS app that just displays a website. The site allows users to record audio. The purpose is to let mobile Safari users to record audio (which is currently not supported). Are there any decent solutions for this or am I going to have to hack my way through? So far I have the following two ideas:
1) Build a native application that contains a WKWebView of the site. If the website detects mobile Safari it will launch some JavaScript that the app can respond to (or it will try to bring the user to the App Store using Universal Links). The native app will then record the audio and send it back to the website somehow (either through an external server, or perhaps through JavaScript, not sure how much data can be passed, but it could be up to 1MB).
2) Use an existing solution using perhaps Cordova/PhoneGap.
Hope to get some tips!
Build an hybrid application based on cordova/PhoneGap seems to be the best in my opinion. In addition you can build for iOS and Android (if you need later).
You can easily use this plugin to achieve your app.

Building iOS app, website, and backend

I've only recently started to delve into how building apps work. I'd like to know what the general setup is for a mobile app and a website, in which users can update information on the app through the website.
I'm trying to learn how to make an iOS app with Swift, and use Amazon Web Services as the backend for it. If I wanted to then make a website that would change data on the mobile app, would I have to create a website from scratch with Ruby or Python, and then somehow connect that to the same AWS backend that my iOS app uses?
Thanks.
Usually, most data is stored on a website. Your website can have ways of viewing the data, such as web apps, like jcaron said. An app is usually used for viewing data from the website. When I develop apps (with Swift) I setup a database on a website and connect it to the app using PHP scripts. Then I make the app, with it's own UI, which does HTTP requests to the website and uses the data.
That's a very broad question, with lots of possible answers, but here are some of the options:
you have a native (Objective-C or Swift) iOS app, with its own UI, etc. It exchanges data with your back-end server, which stores stuff in a database and/or forwards messages between clients. Then, you have a website, using any language/framework you want, accessing the same database.
you have a web-based application: you use exactly the same code (with responsive design of course), serve it from your servers using any language/framework you want, and just embed that in a web view in your app
you have an hybrid application: this is close to the previous option, but you do most of the coding client-side (i.e. using Javascript, possibly with frameworks such as Angular) within a Cordova/Phonegap app. The same app would then be deployable as a native app as well as served as a website. You would just have back-end code on the server.

iOS 9 - open resource in web browser on another computer, triggered by tablet

If you had to open a resource from a database in a web browser on another computer, using an Apple tablet app as a remote control, how would you implement such a feature? This is basically what WhatsApp Web does, so it should be technically possible. But how would you go about it?
I'm assuming that you mean a situation where the app modifies something on the server, and the browser then updates automatically to reflect this. If you mean something like the iOS Remote app, then you may have to use another method (and you may not be able to do it from the browser).
To do this you'll have to have a server that both the iOS app and the browser are connected to. When the app does something, it updates the server, e.g. by submitting an HTTP request to a REST API. The server then updates the database.
Now you have to get the browser to update, and there are two ways of going about this. One is by polling the server periodically, using AJAX to update parts of the page dynamically without refreshing the whole page. This works, but there's a lot of overhead and it can be a drain on a laptop battery.
The better, but slightly more difficult to setup, alternative is to use WebSockets. WebSockets allow for two-way communication between server and client, and the connection stays open until one party closes it (or it times out after a long time). The client can submit information to or pull information from the server as before, but the server can also push information to the client without the client having to request it. This would typically be how games, chat clients, etc. can operate nearly in real time.
Setting this up isn't necessarily that difficult, but it's a very broad, open-ended topic that's beyond the scope of just iOS development. Beyond the iOS app and the web client, you'll also need a backend that's capable of using sockets. Node.js is a popular JavaScript-based backend for this sort of application; there are numerous others out there as well. You'll have to do your own research to determine what's right for you.

writing an iOS app to pay utility bill

Ok, I have a client who is a utility provider (like power, water, etc). They want their customers to be able to pay their bill from an iOS app. Since this isn't a product will it be okay to use an alternative payment gateway using WebView?
This specific usage sounds fine. Apple doesn't allow you to sell app content through anything but the store, but taking payment for an entirely external service should be fine, there are dozens of similar apps for general payment processing (LevelUp, 4square, etc.), and this is the same sort of thing, just for a more specific debt.
That said, if all your app is is a WebView wrapper for your site, Apple will reject it because of that. An app that wraps a webview must additionally use a nontrivial amount of native functionality.
In general, if your application is just a UIWebView embedded in a UIView, it will almost certainly be rejected. What is the benefit of an application embedding a mobile version of the website, compared to just loading the mobile site in the default Safari web browser?
If you are going to do this, Apple requires that the application be more than just a web browser loading a default URL. This can be one component of the app, but it cannot be the only component.

What is advantage of embedding HTTP server in iOS app?

In linked in implementation, they have HTTP server implemented in iOS app. What could be the reason behind this architecture, if uiwebview already handles the HTML loading and rendering.
I don't think they have a HTTP server embedded as much as they are just making very liberal use of UIWebView and the features of HTML5.
And the benefits of doing this are that they only have to write a relatively general implementation of the LinkedIn mobile interface in HTML5 and those changes get carried across to iOS, Android, Windows Mobile, and whatever other mobile platforms support HTML5.
I have a couple of apps with an embedded HTTP server. This is used as one possible method for importing/exporting data to/from the app. The user connects to the app from their computer's web browser to the server on their iOS device. The user can then download a file from or upload a file to the app. I added this feature before iOS supported file sharing via iTunes and the Documents directory. It's now one of several ways to get data to/from the app.

Resources