I am new to iphone development. I would like to know how to do the caching in ios 4 and above??
I got many answers but right now I get confused and don't know from where to start.
In my project, I am doing http request and displaying results using UIWebView
Here,I want to cache the http data. So next time when application starts again then It will reload the data from the cache.
how to cache the webpage data in IOs 4 and above?
I have done with caching of whole web page using ASIHTTPRequest. I go through the ASIHTTPRequest: here is a link to it.
You will have to make use of Core Data to store your data locally by modeling your data in it. You will need to go through the core data programming guide: here is a link to it.
http://developer.apple.com/library/mac/documentation/cocoa/Conceptual/CoreData/CoreData.pdf
After you have understood for how to store your data, you will able to easily able to load this when your app starts the next time.
Im not sure of how to store the web view's data as an html page locally, though that can be an alternative approach too.
I hope it helps you!!! Cheers!!
Related
Basically what I want to do I be able to enter in data on a website, and have it appear on an iPhone app, so I want it to send the data to my iPhone, and store it so that every time i open the app, it will re load the data and put it on the screen. How can I go about this?
You will need a backend-side to your app. If you don't have any experience with backend-developing, I would recommend taking a look at Parse.com or other similar backend providers. They give you a server-solution without having to develop it yourself.
Good luck, and welcome to SO!
What I'm building is simply an application that fetches data over the web and displays them on the iOS views. Data are text and, sometimes, images / music files / movies.
I'd like to use some caching solution for the media. What it needs to do is:
get an url of the file
check if it's alredy downloaded in the cache storage, if it is, serve it
if not, download it
while also checking how much of the storage the current cache uses, and, if it's over the quota, delete oldest files
Best would be to have a simple interface for this - so I can just give an url and get the file of it (while files can change over time and reside on the same URL, so this should be handled too, in a perfect case).
Anyone knows a library to do it, on iPhone/iPad application?
ASIHttpRequest has a DownloadCache option that may work for you. From their documentation:
* You want to have access to the data when there is no internet connection and you can't download it again
* You want to download something only if it has changed since you last downloaded it
* The content you are working with will never change, so you only want to download it once
This is what I used in my iPad app and it works pretty well.
You could try looking at using a UIWebview for the view. If I am understanding this correctly, you will be hosting your content on a web server and would simply like the iOS device to pull the content from the URL. This is what UIWebview is. It is essentially programmable access to Safari.
I'm new to iPhone development and I still have some gaps that needs to be filled in the first application I'm developing. This app will consume data from a site managed by Wordpress through the Wordpress JSON plugin, which allows to retrieve the posts in the form of a json string.
I wanted my application to store the posts in some form of caching, so that the users would only need to download the new content after the first time. Think about the Twitter App, that keeps all your previous loaded tweets and only load the new ones.
What's the best way to do that, should I save the json as a file or there are another more efficient method to keep it in cache?
I'm currently developing an app that will deal with this kind of stuff. And I found many possible solutions.
If you still have issues with this, have a look here: http://cocoawithlove.com/2010/09/substituting-local-data-for-remote.html
If your app has to be simple, this could be perfect.
An other way could be to subclass NSURLProtocol, but I'm still investigating on this solution.
Hey everyone. I have a fair amount of experience developing iOS apps, but nothing much with web/server interacting apps. For a project at work, I am making an app that will let you login, and get pictures off from a server that will then be downloaded for display and review on the local device.
I need to get some pointers on the correct approach to take. Are there built-in classes that make doing something like this easy? Once the cogent is downloaded from the server, it will be viewed locally, so all I need is to get a point in the right direction for logging in and communicating with a server…from an iPhone.
Can anybody point me in the right direction?
Me, I'm using ASIHTTPRequest Librayry to communicate / download with Internet.
For example, for an news app I download latest news in JSON (with a PHP script on a web server) and store datas with SQLite. If you need a little explanation of JSON with iPhone, check here (in french, but source codes are in english ^^)
When I need to download an image, I use ASIHTTPRequest and a queue to avoid downloading to much files at the same time.
If you want more information about a step, just say it.
Good Luck !
NURLConnection is your friend, along with its delegate methods.
Don't be lured by the temptation to use the -sendSynchronous method (which, now that I think about it, if you require authentication, you probably can't use anyway).
I've built a simple iPhone app that parses data from a remote XML feed, converts the information into objects (they're videos), and displays the videos in a standard table view->detail view->"Play Video" UI. There are hundreds of videos, each with about ten attributes. (The videos are never downloaded, only streamed, using MPMoviePlayerController.) I've relied on the Apple sample application SeismicXML for much of the app's behavior.
Now I'm ready for the next step: saving the video metadata to the device, so that users aren't forced to wait for the XML retrieval and parsing every time they launch my app. I'm planning to use Core Data to save my Video objects (and their parent Channel objects), but it's all brand new to me.
My question is: Can folks recommend any sample application or design pattern for managing this data? I want to have the app automatically download and parse the XML at launch, but then it should refresh the data only when the user taps a Refresh button, or if the data is older than, say, a day.
Apps that model this behavior are NYTimes, AP, and many others.
Besides the excellent documentation that Apple provides for Core Data, are there any resources out there for architecting an iPhone app that needs to download, save, and periodically refresh its data?
Thanks.
Update on 11/12/2009: Between the Apple sample code for TheElements, TopSongs, CoreDataBooks, PhotoLocations, iPhoneCoreDataRecipes, and XMLPerformance, I've got plenty of grist for the mill here. I'm currently analyzing the samples, and slowly piecing together what I need.
Looks like you found all of the Apple samples, so that's good.
The Pragmatic Programmers have a book on Core Data, and several of the iPhone SDK books out (including theirs) touch on Core Data a little. See also this question.
Edit: forgot to mention Three20 (the guts of the Facebook app, Open Sourced) as an example of a way to do this that isn't Core Data. Rather than re-constructing the downloaded data in some object graph that's persisted with Core Data, Three20 implements disk caching and freshness dating on top of the URL loading system. The app basically still works by making HTTP API calls, and parsing the responses, but doesn't have to talk to the cloud on every screen display, which speeds things up immensely. If you're only downloading this information to display in a big table view, and not anything else, perhaps this model might be easier.