LocationIQ provides flexible enterprise-grade location based solutions. We work with developers, startups and enterprises worldwide serving billions of requests everyday. This page provides an overview of the technical aspects of our API and will help you get started.
This ObjC package is automatically generated by the OpenAPI Generator project:
- API version: 1.1.0
- Package version:
- Build package: org.openapitools.codegen.languages.ObjcClientCodegen
The SDK requires ARC (Automatic Reference Counting) to be enabled in the Xcode project.
Install from Github using CocoaPods
Add the following to the Podfile:
pod 'LocationIq', :git => 'https://github.com/location-iq/locationiq-objc-client.git'
To specify a particular branch, append , :branch => 'branch-name-here'
To specify a particular commit, append , :commit => '11aa22'
Install from local path using CocoaPods
Put the SDK under your project folder (e.g. /path/to/objc_project/Vendor/LocationIq) and then add the following to the Podfile:
pod 'LocationIq', :path => 'Vendor/LocationIq'
Import the following:
#import <LocationIq/OAIApiClient.h>
#import <LocationIq/OAIDefaultConfiguration.h>
// load models
#import <LocationIq/OAIAddress.h>
#import <LocationIq/OAIBalance.h>
#import <LocationIq/OAIDaybalance.h>
#import <LocationIq/OAIDirectionsDirections.h>
#import <LocationIq/OAIDirectionsDirectionsRoutes.h>
#import <LocationIq/OAIDirectionsMatching.h>
#import <LocationIq/OAIDirectionsMatrix.h>
#import <LocationIq/OAIDirectionsMatrixSources.h>
#import <LocationIq/OAIDirectionsNearest.h>
#import <LocationIq/OAIDirectionsNearestWaypoints.h>
#import <LocationIq/OAIError.h>
#import <LocationIq/OAILocation.h>
#import <LocationIq/OAIMatchquality.h>
#import <LocationIq/OAINamedetails.h>
// load API classes for accessing endpoints
#import <LocationIq/OAIAutocompleteApi.h>
#import <LocationIq/OAIBalanceApi.h>
#import <LocationIq/OAIDirectionsApi.h>
#import <LocationIq/OAIMatchingApi.h>
#import <LocationIq/OAIMatrixApi.h>
#import <LocationIq/OAINearestApi.h>
#import <LocationIq/OAIReverseApi.h>
#import <LocationIq/OAISearchApi.h>
It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issues.
Please follow the installation procedure and then run the following:
OAIDefaultConfiguration *apiConfig = [OAIDefaultConfiguration sharedConfig];
// Configure API key authorization: (authentication scheme: key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"key"];
NSString* *q = "Empire state"; // Address to geocode
NSNumber* *normalizecity = 1; // For responses with no city value in the address section, the next available element in this order - city_district, locality, town, borough, municipality, village, hamlet, quarter, neighbourhood - from the address section will be normalized to city. Defaults to 1 for SDKs.
NSNumber* *limit = 10; // Limit the number of returned results. Default is 10. (optional) (default to @10)
NSString* *viewbox = "-132.84908,47.69382,-70.44674,30.82531"; // The preferred area to find search results. To restrict results to those within the viewbox, use along with the bounded option. Tuple of 4 floats. Any two corner points of the box - `max_lon,max_lat,min_lon,min_lat` or `min_lon,min_lat,max_lon,max_lat` - are accepted in any order as long as they span a real box. (optional)
NSNumber* *bounded = 1; // Restrict the results to only items contained with the viewbox (optional)
NSString* *countrycodes = "us"; // Limit search to a list of countries. (optional)
NSString* *acceptLanguage = "en"; // Preferred language order for showing search results, overrides the value specified in the Accept-Language HTTP header. Defaults to en. To use native language for the response when available, use accept-language=native (optional)
NSString* *tag = "place"; // Restricts the autocomplete search results to elements of specific OSM class and type. Example - To restrict results to only class place and type city: tag=place:city, To restrict the results to all of OSM class place: tag=place (optional)
OAIAutocompleteApi *apiInstance = [[OAIAutocompleteApi alloc] init];
[apiInstance autocompleteWithQ:q
normalizecity:normalizecity
limit:limit
viewbox:viewbox
bounded:bounded
countrycodes:countrycodes
acceptLanguage:acceptLanguage
tag:tag
completionHandler: ^(NSArray<NSObject*>* output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
All URIs are relative to https://eu1.locationiq.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
OAIAutocompleteApi | autocomplete | GET /autocomplete.php | |
OAIBalanceApi | balance | GET /balance.php | |
OAIDirectionsApi | directions | GET /directions/driving/{coordinates} | Directions Service |
OAIMatchingApi | matching | GET /matching/driving/{coordinates} | Matching Service |
OAIMatrixApi | matrix | GET /matrix/driving/{coordinates} | Matrix Service |
OAINearestApi | nearest | GET /nearest/driving/{coordinates} | Nearest Service |
OAIReverseApi | reverse | GET /reverse.php | Reverse Geocoding |
OAISearchApi | search | GET /search.php | Forward Geocoding |
- OAIAddress
- OAIBalance
- OAIDaybalance
- OAIDirectionsDirections
- OAIDirectionsDirectionsRoutes
- OAIDirectionsMatching
- OAIDirectionsMatrix
- OAIDirectionsMatrixSources
- OAIDirectionsNearest
- OAIDirectionsNearestWaypoints
- OAIError
- OAILocation
- OAIMatchquality
- OAINamedetails
- Type: API key
- API key parameter name: key
- Location: URL query string