i am new to iOS development , recently i'm working with 'ASIHTTPRequest' library. i have downloaded it's example from Here. it's working fine. I need to send a parameter to my web service as 'email' and also authentication needed.
i tried following
[request setPostValue:@"[email protected]" forKey:@"email"];
based on this Reference
but it's give me warning that Instance method -setPostValue:forKey() not found
. How can i pass email id as parameter to web service? For your reference i use web service to reset password when user forgot it.
EDIT :
Now , i need to convert following code into ASIFormDataRequest
from ASIHTTPRequest
with email id parameter and authentication. can you help me now ?
`
[self setRequest:[ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://abc.foo.com/api/forgot_password/"]]];
[request setUseKeychainPersistence:[useKeychain isOn]];
[request setDelegate:self];
[request setShouldPresentAuthenticationDialog:[useBuiltInDialog isOn]];
[request setDidFinishSelector:@selector(topSecretFetchComplete:)];
[request setDidFailSelector:@selector(topSecretFetchFailed:)];
[request startAsynchronous];
`
That's because ASIHTTPRequest
doesn't include a -setPostValue:forKey:
method. ASIFormDataRequest
, on the other hand, does.
It sounds like you're using a pointer of type ASIHTTPRequest*
to send a message to an instance of ASIFormDataRequest
. That's okay if the pointer really points to a form data request, ASIFormDataRequest being a subclass of ASIHTTPRequest, but if you're sure enough about the type of the object that you can send it a message specific to it's type, you also know enough to either use the more specific type in the first place or use a type cast to let the compiler know that it doesn't need to complain.