Это ошибка AFNetworking или googleapi? Я получаю только частичный результат json. И если я попробую в Chrome, все будет хорошо.AFNetworking получить json из Google Geocode API не заполнен
NSString *urlstring = [NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/geocode/json?components=postal_code:\"%@\"", zipcodefield.text];
urlstring = [urlstring stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager.responseSerializer setAcceptableContentTypes:[NSSet setWithArray:@[@"application/json"]]];
[manager GET:urlstring parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {
NSDictionary *zipfile = (NSDictionary *)responseObject;
NSLog(@"%@", zipfile);
} failure:^(NSURLSessionTask *operation, NSError *error) {
//some code
}];
возвращает JSON только часть результате я получил с Chrome:
{
results = (
{
"address_components" = (
{
"long_name" = "N2L 3W6";
"short_name" = "N2L 3W6";
types = (
"postal_code"
);
},
{
"long_name" = Waterloo;
"short_name" = Waterloo;
types = (
locality,
political
);
},
{
"long_name" = "Waterloo Regional Municipality";
"short_name" = "Waterloo Regional Municipality";
types = (
"administrative_area_level_2",
political
);
},
{
с Chrome, он возвращает другой полный результат:
{
"results" : [
{
"address_components" : [
{
"long_name" : "N2L 3W6",
"short_name" : "N2L 3W6",
"types" : [ "postal_code" ]
},
{
"long_name" : "Waterloo",
"short_name" : "Waterloo",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Waterloo Regional Municipality",
"short_name" : "Waterloo Regional Municipality",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Ontario",
"short_name" : "ON",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Canada",
"short_name" : "CA",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Waterloo, ON N2L 3W6, Canada",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 43.4774664,
"lng" : -80.53395789999999
},
"southwest" : {
"lat" : 43.47248219999999,
"lng" : -80.538017
}
},
"location" : {
"lat" : 43.473585,
"lng" : -80.5351634
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 43.4774664,
"lng" : -80.53395789999999
},
"southwest" : {
"lat" : 43.47248219999999,
"lng" : -80.538017
}
}
},
"place_id" : "ChIJXV6ZhAf0K4gRYW7aCuG25xQ",
"types" : [ "postal_code" ]
}
],
"status" : "OK"
}