AFHTTPClient 子类,用于Census API。
访问上面链接获取您的 census API 密钥。
AFCensusAPIClient* censusClient = [[AFCensusAPIClient alloc] initWithAPIKey:@"YOUR CENSUS KEY HERE"];
[censusClient getMetric:kCensusMetric_OwnerOccupiedHousing
withLat:@"42.343653"
withLng:@"-71.097701"
success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"Lower Value Owner Occupied Housing: %@", responseObject[kCensusMetric_LowerValueForOwnerOccupiedHousing]);
NSLog(@"Median Value Owner Occupied Housing: %@", responseObject[kCensusMetric_MedianValueForOwnerOccupiedHousing]);
NSLog(@"Upper Value Owner Occupied Housing: %@", responseObject[kCensusMetric_UpperValueForOwnerOccupiedHousing]);
} failure:nil];
目前使用常量支持的指标有限,但您可以始终更新此仓库,或者直接传入代码。作为内置常量:
PJ Gray
AFCensusAPIClient 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。