asidownloadcache for post request? - ios

In my iOS app,I'm sending a post request using the asihttprequest methods and receiving json data.
i want to be able to cache the parsed json data if possible (so that i can directly extract and display in the tableview).
asidownloadcache is helpful only if i'm using GET method. So, i'd like to know my options(along with an example if possible)
Thanks a ton for the help, in advance..

Related

Get JSON data from a specific URL in swift

What Im trying to do is get the data from this specific url https://www.globalmoneyworld.com/global-media-blog
Once I get the JSON data, Im positive I know how to use it. Ive made several apps in class that touch on this, one was a weather app, the other pulled blog posts from the guardian. The guardian app was more of what I waned to learn than the weather app.
The problem Im running into is that I cannot figure out how to ask for the data. How to get this type of response
http://jsonplaceholder.typicode.com/users/1
this is the link I want to get the data from again
https://www.globalmoneyworld.com/global-media-blog
What kind of request do I need to type in using Alamofire to get JSON data from that specific url? And please guide me in the right direction if Im not asking the right question.
The website you linked returns HTML data, not JSON.
There is no type of request you can make using Alamofire that will give you JSON from an arbitrary URL. The only URLs that return JSON are from sites that allow queries that return JSON. The good news is that JSON is widely supported as a data exchange protocol.

Multiple asynchronous URL requests in ios

I have almost Ten url which provide some data in json formate and XML formate from different site. Now i want call all url asynchronously to use multithreade and i want get one notification when finish all response.So how i can achieve this functionality in ios.
Please help me.
Thanks in advance.

JSON GET and POST

I am learning iOS app development.
I have JSON data coming from one of the sites in the form of Dictionary within an Array and within that Dictionary I have another Array and that contains another Dictionary.
for ex ,
Now I want to deserialize it and use it in my iOS app and also I have to post some data like a comment back to the server.The comment by teacher will be a POST to the server.
I hope the question makes sense.
I am stuck on how to deserialize this and use POST to server.
Any help is appreciated. Thanks in advance.
There are a couple of parts to your question:
1) To get the JSON data into a format which can easily be manipulated by your program, it's easiest to take an existing open-source JSON parser library and integrate it into your app. I like SBJSON. If you go to that site, it has instructions on including and using the library in your project.
2) To post a reply to the server, you need to know what format it expects the data in. Is your app interacting with an existing website (where a user could go to a page and fill out a form), or is it talking to an API?

Example on using AFNetworking to post XML?

As a followup to this question, I cannot get this to work so I need to take a step back I think.
Can someone post some sample code on how to post XML to a rest service WITHOUT using params? Is it even possible? Basically I have an object with several properties, and I convert this to XML and then need to upload it. But it fails if there is an image converted to string in the XML. Without that it works fine.
Even a JSON example would be helpful...
Totally blocked here :P
Use NSMutableURLRequest -setHTTPBody:, and set the Content-Type HTTP header to application/xml.
If you're doing this consistently, you may want to consider subclassing AFHTTPClient to add an XML parameter serialization option.

sending post data from Iphone

I want to send post data from Iphone.
I have to send a dictionary(K-V pairs) with 8 k-v pairs.
What is the best way to post all these 8 K-V pairs from Iphone.
I want that i should pass only Id(one of K-V pair)in the URL & remaining K-V pairs should be sent via post.
if there is something like that??
I wrote a couple blog posts using NSURLConnection. One was specifically for sending POST data. Check them out. You can't send some data with GET and some data with POST. You have to commit to all one way.
Sending POST DATA
Using NSURLConnection
HTH
The HTTP protocol doesn't work like that. Pick POST or GET.
This library makes web requests easy, including file upload: http://allseeing-i.com/ASIHTTPRequest/

Resources