Save multiple sets of data locally on iOS - ios

We have a basic application that uses a storyboard for all the 'pages'. Each page has basic product info and there is a contact form. It's used at trade shows, usually with an internet connection, therefore the contact form is just a UIWebView.
The next event has no internet available and I need to set up the contact / details form to work offline and store the info on the device (iPad), with a page to also retrieve it. I'm not overly experienced with iOS (but I'm proficient in programming knowledge), so any ideas or pointers to tutorials would be great. Thanks!

You can save your data in the form of a plist.
Later you can load your data from the plist using the code here.
Load NSDictionary from plist

Plist can be helpfull but you are using webview so you cannot put plist's data to webview. so you need to cache your pages. that can be enought for your situation: iOS Cache a UIWebView
Or this approach is better to use UIWebView webpage caching for offline viewing

Related

Best option for storing external database for iOS app

I am working on an app that will access an external database that needs to be able to load quickly. This is our own database, and the issue is where to store it for the fastest loading time. Currently, the database resides on a wpengine website, but it loads very slowly. One option is uploading a .plist file sporadically to the user's app when new data is available; it seems like that might not be very secure - although it would probably make accessing the data lightning fast. I was thinking that possibly CloudKit shared storage would be the best place to store the data if I wanted to keep it fast and also keep users from viewing it directly. I would appreciate any thoughts or suggestions.
As far as I understand, CloudKit will be OK for you. You can have a look at NSHipster's excellent summary here.
You also have a link to a tutorial in the comments above. If you want to discuss it further, don't hesitate to contact me through chat.

Making app for Offline Browsing

I am new to objective c and still learning. I am making an app for my project in which user can download the whole website or webpage for later browsing..so i need some guidance, so if any one can give some suggestion that would be great
There are many ways to achieve what you asked for. Either by saving the websites data in temporary folder or you may save the whole site as pdf.

HTML contents preloaded into an app and then updated from the Internet

The title says (quite) all: I would like to distribute an app with some HTML pages preloaded into the local Documents folder (they reflect the content of a mini mobile site available on the internet); then, when the contents of the pages are updated, the local HTML files into the app should be updated, so that the user can browse the updated informations also when not connected to the internet.
The app has to work since the first start, thanks to the preloaded pages, and then update itself periodically (I didn't need to check the modify date/time of the single files, it's enough to check and update them when the local copies are older than x days).
The problem: I think I can do it all, but I was asking to myself if is there some framework/class that does it automatically, because it sounds to be a pain :)
Consider using ASIHTTPRequest. Check out this SO question.
Specifically, you might want to look into ASIWebPageRequest:
download complete webpages, including external resources like images
and stylesheets. Pages of any size can be indefinitely cached, and
displayed in a UIWebview / WebView even when you have no network
connection.
I've also used AFNetworking for my own personal projects and it's made my life 10x easier. On the AFNetworking FAQ page, there's a question regarding caching mechanisms for offline viewing. It mentions that NSURLCache in iOS 5 introduced support for caching to disk for offline use - but only for http. If you need to cache https, consider using SDURLCache.
Here's a short additional resource in regards to network caching for iOS.
Read the section titled iOS network caching
If you are looking at pre popping your iOS app with the equivalent of a browser cache then
https://github.com/rs/SDURLCache might be something to look into.
It hooks in with existing NSURLConnection frameworks such as AFNetworking and you just need to set the correct cache policy in your NSURLRequest.
Given its open source you should be able to figure out how where to place your data so it loads it without fetching from the server the first time then just specify when you want the cache to purge itself so it fetches it from the server?

Offline webapp on iPad

I have a website written in php / javascript. It's quite simple, basically :
on the first page it shows a list of category
when a category is clicked, a new page is displayed with a list of pictures (that can be clicked to get a bigger version, using AJAX) and some text details
I'd like to be able to browse this site offline on an iPad, what would be the better way ?
I saw it is possible to add some html5 caching capability, would this be the way to go ?
You should try the HTML5's caching and/or persistent storage feature. You can save app data or even whole files, and either access them from JavaScript to display, or ask the browser to seamlessly display the cached files when there's no Internet connection. Some links may help:
http://www.html5rocks.com/en/tutorials/appcache/beginner/ <- this one is the caching-related
http://dev.w3.org/html5/webstorage/ <- and this is about persistent storage.
Hope that helps, Árpád

How do i save some data from the UIWebView in an application for IPad

I am making an app for an IPad.
I have loaded a local html file in the UIWebView. I have now collected some data from the user. I want to save this locally so it can be used by the application for some other purpose.
You could start reading about Property lists. I think that it could be very useful for your purpose.
store the information in plist if it is not huge and use it whenever required.

Resources