iOS - RestKit and sending a post request to the server? - iphone

When I try to post an object using RestKit I get the following error.
"Cannot send a request that is loading or loaded without resetting it first."
What does it mean?
How can I reset a request?

Without posting a code, it is hard to say where the error is, but:
This error occurs, when either _isLoading or _isLoaded is set to NO. You could try to reset your request before sending it using [myRequest reset];.

Related

Apache httpclient 4.5.2 not sending POST data on retry via ServiceUnavailableRetryStrategy

I have setup the HttpClient with ServiceUnavailableRetryStrategy. I am making a POST call to the server with JSON payload in InputStreamEntity.
When server returns with "503 Service Unavailable" the retry strategy kicks in and makes another request after a delay read from Retry-After header.
I have enabled the logs and what I observe is, in the first request the JSON payload is sent properly. But on the retry request no payload is sent to the server and I am receiving a "400 Bad Request".
I wonder why the payload is not sent on the retry request. In my implementation of ServiceUnavailableRetryStrategy I am not messing anything with HttpResponse or HttpContext. Is it because that once the content is read from InputStreamEntity, the Entity looses the data?
Is there anyway to prevent this from happening? Any help or suggestions will be appreciated.
thanks
The issue was actually with InputStreamEntity, which is a non-repeatable Entity. This means its content cannot be read more than once. So on retry the original Entity content was lost.
When I use a repeatable Enity like ByteArrayEntity, the issue was solved.
https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/fundamentals.html#d5e119

Failed to perform attach connection with Strophe.js

I'm using the attach feature from Strophe.js, so when I lose my internet connection I can keep the same session alive.
Sometimes it works properly and I can do the attach, while I don't have any problem making different requests.
The problem apparently occurs when a request is pending, in queue, and is sent after the attach reconnection.
For example, I perform the attach with rid = 100 and when I perform a request (example: retrieve the roster) , the rid request is now 101, but when I check the console, I can see an stanza with rid = 98 has been sent, so I got an item-not-found error and the session closes. I know this error is because the rid is not correct.
Any idea where I can modify the code to avoid sending malformed rid stanzas? or any possible solution?
Thanks

NSURLConnection delegate methods not giving the response immediately

Hi in my application I am using NSURLConnection delegate metods to get a response from the server.Here what is happening is when ever I send a request to the server for the first time I am getting response immediately.After that first request if I send same request to the server again immediately I am getting the response as null. But if i leave the ipad aside after sometime I am getting the response can you please let me know is there any time limit needed between the requests while sending to the server using NSURLConnection delegate methods.Please help me to resolve this issue.
Thanks in advance.

AFNetworking and Network Errors

I am using the AFNetworking framework to make several JSON web request.
During development if I fail to provide a required parameters or the Service developers have broken something :-) i receive a 500 error
The Error block of AFJSONRequestOperation is correctly catching it. However i cannot see the page body because AfNetworking is cancelling the request as soon as the error code in the head is received.
Is there some work around. I would like to spit out the response body to the log.
Use the responseData or responseString property from the operation that's passed into the failure block.
You'll need to add the http Code 500 to the acceptable status codes and filter it on the success callback. There you will have a responseObject.

Facebook error: Encountered an error while processing the request: 502 Error parsing server response. Got EOF while waiting for outstanding responses

Today I started receiving errors from Facebook when my app tries to post a message.
The app successfully authorised, Facebook message window pops up, everything looks fine (links, pics, description) , but when I press post. it times out with this message
Encountered an error while processing the request: 502 Error parsing server response. Got EOF while waiting for outstanding responses Please try resending your request. This is probably not a bug in proxygen. Based on experience, either intern or latest is temporarily down due to a SEV or push. Please check in e FYI or #e first. If the error persists through retries, or if you have good reason to suspect this is a bug in proxygen, please report the issue to ti-bugs#lists or #ti with the following debug information: 2012-05-20 22:24:40 slb010.02.snc5 1585267068836963531
UPDATE: It is a Facebook issue. There is an opened and assigned bug report here You can subscribe there to follow the process.
It looks like Facebook fixed the issue. My apps work fine.
If you still experience the same problem, you can check out the progress here: http://developers.facebook.com/bugs/411849912170144?browse=search_4fb9fb43db2468a28526107
If this issue comes up again check whether there is an already submitted bug here: http://developers.facebook.com/bugs/ if there isn't submit one