有没有办法缓存ASIFormDataRequest?
我使用 ASIFormDataRequest 来发布数据,然后使用 JSON 进行解析。 ASIHTTPRequest 使用 [ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]];
内置缓存。有谁知道 ASIFormDataRequest 是否有类似的东西?
例子:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/myapp/20110715/60b88126/load_dr_daily_schedule/%@/", [self getHost], [dateFormat stringFromDate:today]]];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[self addCurrentUserLoginToPostRequest:request];
[request setPostValue:[dateFormat stringFromDate:today] forKey:@"target_date"];
[request startSynchronous];
NSError *error = [request error];
NSString *responseString;
if (!error) {
responseString = [request responseString];
} else {
return NULL;
}
return [responseString JSONValue];
I'm using ASIFormDataRequest for Post data then parsing with JSON. ASIHTTPRequest has built in caching using [ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]];
. Does anyone know if there is anything similar for ASIFormDataRequest?
Example:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/myapp/20110715/60b88126/load_dr_daily_schedule/%@/", [self getHost], [dateFormat stringFromDate:today]]];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[self addCurrentUserLoginToPostRequest:request];
[request setPostValue:[dateFormat stringFromDate:today] forKey:@"target_date"];
[request startSynchronous];
NSError *error = [request error];
NSString *responseString;
if (!error) {
responseString = [request responseString];
} else {
return NULL;
}
return [responseString JSONValue];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ASIFormDataRequest 是 ASIHTTPRequest 的子类,因此它与 ASIHTTPRequest 具有相同的属性。
请注意,它不会缓存 POST 请求。
ASIFormDataRequest is a subclass of ASIHTTPRequest, so it was the same properties as ASIHTTPRequest.
Note that it won't cache POST requests though.