Skip to content
AFHTTPClient subclass for the Census API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
AFCensusAPIClient
Example
.gitignore
AFCensusAPIClient.podspec
LICENSE
README.md

README.md

AFCensusAPIClient

An AFHTTPClient subclass for the Census API.

Instructions

Install

Available on CocoaPods, simply add to your Podfile:

pod 'AFCensusAPIClient'

then do a 'pod install'

Code

Go to the above link to get your census API key.

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];

Supported Metrics

Supported metrics using constants is limited right now, but you can always update this repo, or pass in the codes directly. As built-in constants:

  • kCensusMetric_LowerValueForOwnerOccupiedHousing
  • kCensusMetric_MedianValueForOwnerOccupiedHousing
  • kCensusMetric_UpperValueForOwnerOccupiedHousing
  • kCensusMetric_MedianHouseholdIncome

Contact

PJ Gray

License

AFCensusAPIClient is available under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.