I thought this would be a common problem, but I haven’t been able to find many solutions or suggestions.
My iPhone application is using ASIHTTPRequest to interact with web services. I need the app to remain functional even when there isn’t a network connection. I’m attempting to create a general purpose solution that will queue requests while the application is offline. Then, once a network connection is available the requests are pushed through the queue (it could be while the app is still running or it could be when the app is restarted at some point in the future).
I’ve been considering a couple of different options. Unfortunately, ASIHTTPRequest doesn’t implement the NSCoding protocol so there isn’t a nice way to persist the objects on the disk. The other option would be to save the required properties from each request object into an SQLite database, and then reconstruct the ASIHTTPRequest objects when a network connection becomes available. This seems reasonable, but the “required properties” may vary from request to request and I’m ultimately looking for a solution that will work in all cases with all types of requests.
Has anyone implemented something like this?
Second option make sense.. You can create the header and body just like passing to ASI to make a request but except write it to sqllite db.. If then your app has a network connections, just create request with those params (header, body) .. So it doesnt dependent the type of request.. Because you’ve already prepared your request param while your app ofline..