Параметри на AFNetworking 2.0 и GET Request

Имам въпрос относно AFNetworking 2.0

Трябва да направя GET заявка като тази:

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

Как да генерирам параметрите на речника за тази заявка?

По-специално не разбирам как мога да създам това: and $EntityCreationDate>'2014-09-01'


person Safari    schedule 06.09.2014    source източник


Отговори (1)


Тук намерих добър урок.

Което гласи, че проста GET заявка може да бъде изпратена по следния начин:

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];
person rptwsthi    schedule 06.09.2014