am setting the parameters(key-value pairs - user name, password, email id) for NSMutableURLRequest(POST) using the class method
+ (void)setProperty:(id)value forKey:(NSString *)key inRequest:(NSMutableURLRequest *)request
and requesting the server using sendSynchronous.
But at the server end, 开发者_StackOverflow中文版the parameters are null.
plz suggest me some other new solution???
Use ASIFormDataRequest
. Its -setPostValue:forKey:
method makes POSTing data as application/x-www-urlformencoded
or multipart/form-data
dead simple.
If you want to use NSURLRequest
instead, check out the OAuthConsumer project for an example of using application/x-www-form-urlencoded
. Start by reading -setParameters:
in NSMutableURLRequest+Parameters.m and go from there. For sending data as
multipart/form-datausing
NSURLRequest`, see Facebook's FBRequest.
+[NSURLProtocol setProperty:forKey:inRequest:]
is intended to be used to extend the URL loading system to support additional protocols:
Protocol implementors who need to extend the capabilities of
NSURLRequest
andNSMutableURLRequest
[by providing categories on these classes] can store and retrieve protocol-specific request data by usingNSURLProtocol
’s class methodspropertyForKey:inRequest:
andsetProperty:forKey:inRequest:
. (here)
精彩评论