1

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:@"abcd@gmail.com" 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];

`

4

1 回答 1

1

那是因为ASIHTTPRequest不包括-setPostValue:forKey:方法。ASIFormDataRequest,另一方面,确实如此。

听起来您正在使用类型的指针ASIHTTPRequest*将消息发送到ASIFormDataRequest. 如果指针确实指向表单数据请求,那没关系,ASIFormDataRequest 是 ASIHTTPRequest 的子类,但如果您对对象的类型足够肯定,可以向它发送特定于其类型的消息,那么您也足够了解要么首先使用更具体的类型,要么使用类型转换让编译器知道它不需要抱怨。

于 2013-07-18T14:15:37.313 回答