以下是我的jsp call
:
NSString *strURL = [NSString stringWithFormat:@"https://xxx.com/xx/jsp/Implementation/getMyResource.jsp?uid=xxxxx"];
NSURL *urlLink = [[NSURL alloc] initWithString:strURL];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:urlLink];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
operation.responseSerializer = [AFXMLParserResponseSerializer serializer];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSXMLParser *xmlParser = (NSXMLParser*)responseObject;
NSLog(@"%@",xmlParser);
NSError * parsedError = nil;
NSDictionary *dictUserDetails = [XMLReader dictionaryForNSXMLParser:xmlParser error:&parsedError];
if (parsedError == nil) {
NSLog(@"%@",dictUserDetails);
}
else
{
NSLog(@"wrong while parsing xml data");
}
} failure:^(AFHTTPRequestOperation *request, NSError *error){
NSLog(@"Error:------>%@", [error description]);
}];
No response
。立即paste
strURL link
web browser
get response
no problem
url
{{1}} {/ 1}}。
答案 0 :(得分:0)
您需要将AFHTTPRequestOperation
添加到队列中:
[[NSOperationQueue mainQueue] addOperation:operation];
请参阅https://github.com/AFNetworking/AFNetworking#get-with-afhttprequestoperation