Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we store NSURLRequest directly into Core Data?

I am developing iPad Application in which i need to create Multiple NSURLRequest. When is it fails I need to fire that URL request again.

I have three type (Create School, Create Floor and Create Rooms) of request which contain multiple parameters different create Request.

There is retrial method which can fire when there is internet available with same object which was created on first request.

So I was trying to create three Tables and I was trying to store all parameter with their status.

Is it possible to create Single Table with NSURLRequest irrespective of CREATE REQUEST?

like image 886
Anil Gupta Avatar asked Oct 18 '22 19:10

Anil Gupta


1 Answers

So I came up with my own idea I am sharing with all.

As per I read and googling , I can not store NSURLRequest into core data. because I don't know type of object.

I will create core data table with column PARAMS, METHODS, URL

So can I create Table which will contain column of PARAMS (Dict), Methods (PUT, GET etc), URL.

What I will do that I can convert DICT params into NSKeyedArchiver and save it into PARAM column. URL and METHODS in separate column.

When ever I need save request, I can grab it from table and send to server.

like image 65
Anil Gupta Avatar answered Oct 20 '22 22:10

Anil Gupta