简体   繁体   中英

AFNetworking 2.0 and GET Request parameters

I have a question about AFNetworking 2.0

I have to make a GET request like this:

http://myhost.come/entity?language=en&query=$UserId=14 and $EntityCreationDate>'2014-09-01'

How to generate the Dictionary parameters for this request?

In particular I not understand how can I build this: and $EntityCreationDate>'2014-09-01'

Here I found a good tutorial .

Which states a simple GET request can be sent like this:

AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://samwize.com/"]];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET"
                                                        path:@"http://samwize.com/api/pigs/"
                                                  parameters:nil];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
    // Print the response body in text
    NSLog(@"Response: %@", [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"Error: %@", error);
}];
[operation start];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM