I m trying to retrieve images and videos from a server. m using the following code..
- (void)sendBodyRequestWithTopLeftX:(NSNumber *)tx
topLeftY:(NSNumber *)ty
bottomRightX:(NSNumber *)bx
bottomRightY:(NSNumber *)by
dateFrom:(NSDate *)dateFrom
dateTo:(NSDate *)dateTo{
NSURL *url = [NSURL URLWithString:@"http://server/searchMedia?topLeftX=<float>&topLeftY=<float>&bottomRightX=<float>&bottomRightY=<float>&dateFrom=<date>&dateTo=<date>"];
_request = [ASIFormDataRequest requestWithURL:url];
[self sendRequest];
[_request setRequestMethod:@"POST"];
[_request setPostValue:tx forKey:@"topLeftX"];
[_request setPostValue:ty forKey:@"topLeftY"];
[_request setPostValue:bx forKey:@"bottomRightX"];
[_request setPostValue:by forKey:@"bottomRightY"];
[_request setPostValue:dateFrom forKey:@"dateFrom"];
[_request setPostValue:dateTo forKey:@"dateTo"];
[_request setDidFinishSelector:@selector(requestFinished:)];
[_request setDidFailSelector:@selector(requestFailed)];
[_request startAsynchronous];
But i m not getting any response inside my requestFinished function
. Have tried a lot of things but still not. Any one can help me out here.
And please one more thing the value at server side is in float
but when i change my NSNumber
into floats it gives me an error of incompatible types. Any clue.. Thanks..
It doesn't look like you're setting the request's delegate; it won't know what object to notify upon completion/failure otherwise! Add this before your call to startSynchronous
:
// Replace self with the object that implements requestFailed/Finished:.
[_request setDelegate:self];
Also, if you're using POST, why are you using a query string? It's unnecessary.
If you have any more trouble with the ASIHTTPRequest
library, I suggest you read over the documentation. As for your NSNumber
problem, we'll need more information (ideally code).