Overview
The Radar class is the primary interface for the Radar iOS SDK. It provides methods for:
- SDK initialization and configuration
- User identification and metadata management
- Location tracking (foreground and background)
- Trip tracking and management
- Search (places, geofences)
- Geocoding and reverse geocoding
- Distance and routing calculations
- Event handling and conversions
Initialization
isInitialized
class var isInitialized: Bool { get }
Returns whether the SDK has been initialized.
initialize(publishableKey:)
class func initialize(publishableKey: String)
+ (void)initializeWithPublishableKey:(NSString *)publishableKey;
Initializes the Radar SDK.
Call this method from the main thread in your AppDelegate class before calling any other Radar methods.
Your publishable API key.
initialize(publishableKey:options:)
class func initialize(publishableKey: String, options: RadarInitializeOptions?)
+ (void)initializeWithPublishableKey:(NSString *)publishableKey options:(RadarInitializeOptions *)options;
Initializes the Radar SDK with additional configuration options.
Call this method from the main thread in your AppDelegate class before calling any other Radar methods.
Your publishable API key.
Radar SDK initialization options.
Properties
sdkVersion
class var sdkVersion: String { get }
@property (readonly, class) NSString *sdkVersion;
Gets the version number of the Radar SDK, such as “3.5.1” or “3.5.1-beta.2”.
User Identification
setUserId(_:)
class func setUserId(_ userId: String?)
+ (void)setUserId:(NSString *)userId;
Identifies the user.
Until you identify the user, Radar will automatically identify the user by deviceId (IDFV).
A stable unique ID for the user. If nil, the previous userId will be cleared.
getUserId()
class func getUserId() -> String?
Returns the current userId.
setDescription(_:)
class func setDescription(_ description: String?)
+ (void)setDescription:(NSString *)description;
Sets an optional description for the user, displayed in the dashboard.
A description for the user. If nil, the previous description will be cleared.
getDescription()
class func getDescription() -> String?
+ (NSString *)getDescription;
Returns the current description.
class func setMetadata(_ metadata: [AnyHashable: Any]?)
+ (void)setMetadata:(NSDictionary *)metadata;
Sets an optional set of custom key-value pairs for the user.
A set of custom key-value pairs for the user. Must have 16 or fewer keys and values of type string, boolean, or number. If nil, the previous metadata will be cleared.
class func getMetadata() -> [AnyHashable: Any]?
+ (NSDictionary *)getMetadata;
Returns the current metadata.
class func getTags() -> [String]?
+ (NSArray<NSString *> *)getTags;
Returns the current tags.
class func setTags(_ tags: [String]?)
+ (void)setTags:(NSArray<NSString *> *)tags;
Sets tags, replacing any existing tags.
An array of tags. If nil, all tags will be cleared.
class func addTags(_ tags: [String])
+ (void)addTags:(NSArray<NSString *> *)tags;
Adds tags to the existing set.
class func removeTags(_ tags: [String])
+ (void)removeTags:(NSArray<NSString *> *)tags;
Removes tags from the existing set.
An array of tags to remove.
Product
setProduct(_:)
class func setProduct(_ product: String?)
+ (void)setProduct:(NSString *)product;
Sets an optional product name, displayed in the dashboard and reports.
A product name. If nil, the previous product will be cleared.
getProduct()
class func getProduct() -> String?
+ (NSString *)getProduct;
Returns the current product.
Privacy
setAnonymousTrackingEnabled(_:)
class func setAnonymousTrackingEnabled(_ enabled: Bool)
+ (void)setAnonymousTrackingEnabled:(BOOL)enabled;
Enables anonymous tracking for privacy reasons. Avoids creating user records on the server and avoids sending any stable device IDs, user IDs, and user metadata to the server when calling trackOnce() or startTracking(). Disabled by default.
A boolean indicating whether anonymous tracking should be enabled.
Location
getLocation(completionHandler:)
class func getLocation(completionHandler: RadarLocationCompletionHandler?)
+ (void)getLocationWithCompletionHandler:(RadarLocationCompletionHandler)completionHandler;
Gets the device’s current location.
completionHandler
RadarLocationCompletionHandler
An optional completion handler called when the request succeeds, fails, or times out.typealias RadarLocationCompletionHandler = (RadarStatus, CLLocation?, Bool) -> Void
status: The request status
location: The device’s location, if successful
stopped: Whether the device is stopped
getLocation(desiredAccuracy:completionHandler:)
class func getLocation(desiredAccuracy: RadarTrackingOptionsDesiredAccuracy, completionHandler: RadarLocationCompletionHandler?)
+ (void)getLocationWithDesiredAccuracy:(RadarTrackingOptionsDesiredAccuracy)desiredAccuracy
completionHandler:(RadarLocationCompletionHandler)completionHandler;
Gets the device’s current location with the desired accuracy.
desiredAccuracy
RadarTrackingOptionsDesiredAccuracy
required
The desired accuracy (.high, .medium, or .low).
completionHandler
RadarLocationCompletionHandler
An optional completion handler.
Foreground Tracking
trackOnce(completionHandler:)
class func trackOnce(completionHandler: RadarTrackCompletionHandler?)
+ (void)trackOnceWithCompletionHandler:(RadarTrackCompletionHandler)completionHandler;
Tracks the user’s location once in the foreground.
Note that these calls are subject to rate limits.
completionHandler
RadarTrackCompletionHandler
An optional completion handler called when the request succeeds, fails, or times out.typealias RadarTrackCompletionHandler = (RadarStatus, CLLocation?, [RadarEvent]?, RadarUser?) -> Void
status: The request status
location: The user’s location, if successful
events: An array of events generated, if any
user: The user, if successful
trackOnce(desiredAccuracy:beacons:completionHandler:)
class func trackOnce(desiredAccuracy: RadarTrackingOptionsDesiredAccuracy, beacons: Bool, completionHandler: RadarTrackCompletionHandler?)
+ (void)trackOnceWithDesiredAccuracy:(RadarTrackingOptionsDesiredAccuracy)desiredAccuracy
beacons:(BOOL)beacons
completionHandler:(RadarTrackCompletionHandler)completionHandler;
Tracks the user’s location once with the desired accuracy and optionally ranges beacons in the foreground.
Note that these calls are subject to rate limits.
desiredAccuracy
RadarTrackingOptionsDesiredAccuracy
required
The desired accuracy.
A boolean indicating whether to range beacons.
completionHandler
RadarTrackCompletionHandler
An optional completion handler.
trackOnce(location:completionHandler:)
class func trackOnce(location: CLLocation, completionHandler: RadarTrackCompletionHandler?)
+ (void)trackOnceWithLocation:(CLLocation *)location
completionHandler:(RadarTrackCompletionHandler)completionHandler;
Manually updates the user’s location.
Note that these calls are subject to rate limits.
completionHandler
RadarTrackCompletionHandler
An optional completion handler.
Verified Tracking
trackVerified(completionHandler:)
class func trackVerified(completionHandler: RadarTrackVerifiedCompletionHandler?)
+ (void)trackVerifiedWithCompletionHandler:(RadarTrackVerifiedCompletionHandler)completionHandler;
Tracks the user’s location with device integrity information for location verification use cases.
Note that you must configure SSL pinning before calling this method.
completionHandler
RadarTrackVerifiedCompletionHandler
An optional completion handler called when the request succeeds, fails, or times out.typealias RadarTrackVerifiedCompletionHandler = (RadarStatus, RadarVerifiedLocationToken?) -> Void
status: The request status
token: The verified location token, if successful. Verify the token server-side using your secret key.
trackVerified(beacons:desiredAccuracy:completionHandler:)
class func trackVerified(beacons: Bool, desiredAccuracy: RadarTrackingOptionsDesiredAccuracy, completionHandler: RadarTrackVerifiedCompletionHandler?)
+ (void)trackVerifiedWithBeacons:(BOOL)beacons
desiredAccuracy:(RadarTrackingOptionsDesiredAccuracy)desiredAccuracy
completionHandler:(RadarTrackVerifiedCompletionHandler)completionHandler;
Tracks the user’s location with device integrity information for location verification use cases.
Note that you must configure SSL pinning before calling this method.
A boolean indicating whether to range beacons.
desiredAccuracy
RadarTrackingOptionsDesiredAccuracy
required
The desired accuracy.
completionHandler
RadarTrackVerifiedCompletionHandler
An optional completion handler.
trackVerified(beacons:desiredAccuracy:reason:transactionId:completionHandler:)
class func trackVerified(beacons: Bool, desiredAccuracy: RadarTrackingOptionsDesiredAccuracy, reason: String?, transactionId: String?, completionHandler: RadarTrackVerifiedCompletionHandler?)
+ (void)trackVerifiedWithBeacons:(BOOL)beacons
desiredAccuracy:(RadarTrackingOptionsDesiredAccuracy)desiredAccuracy
reason:(NSString *)reason
transactionId:(NSString *)transactionId
completionHandler:(RadarTrackVerifiedCompletionHandler)completionHandler;
Tracks the user’s location with device integrity information for location verification use cases.
Note that you must configure SSL pinning before calling this method.
A boolean indicating whether to range beacons.
desiredAccuracy
RadarTrackingOptionsDesiredAccuracy
required
The desired accuracy.
An optional reason, displayed in the dashboard and reports.
An optional transaction ID, displayed in the dashboard and reports.
completionHandler
RadarTrackVerifiedCompletionHandler
An optional completion handler.
startTrackingVerified(interval:beacons:)
class func startTrackingVerified(interval: TimeInterval, beacons: Bool)
+ (void)startTrackingVerifiedWithInterval:(NSTimeInterval)interval beacons:(BOOL)beacons;
Starts tracking the user’s location with device integrity information for location verification use cases.
Note that you must configure SSL pinning before calling this method.
The default interval in seconds between each location update.
A boolean indicating whether to range beacons.
stopTrackingVerified()
class func stopTrackingVerified()
+ (void)stopTrackingVerified;
Stops tracking the user’s location with device integrity information for location verification use cases.
isTrackingVerified()
class func isTrackingVerified() -> Bool
+ (BOOL)isTrackingVerified;
Returns a boolean indicating whether verified tracking has been started.
getVerifiedLocationToken(completionHandler:)
class func getVerifiedLocationToken(completionHandler: RadarTrackVerifiedCompletionHandler?)
+ (void)getVerifiedLocationToken:(RadarTrackVerifiedCompletionHandler)completionHandler;
Returns the user’s last verified location token if still valid, or requests a fresh token if not.
Note that you must configure SSL pinning before calling this method.
completionHandler
RadarTrackVerifiedCompletionHandler
An optional completion handler.
getVerifiedLocationToken(beacons:desiredAccuracy:completionHandler:)
class func getVerifiedLocationToken(beacons: Bool, desiredAccuracy: RadarTrackingOptionsDesiredAccuracy, completionHandler: RadarTrackVerifiedCompletionHandler?)
+ (void)getVerifiedLocationTokenWithBeacons:(BOOL)beacons
desiredAccuracy:(RadarTrackingOptionsDesiredAccuracy)desiredAccuracy
completionHandler:(RadarTrackVerifiedCompletionHandler)completionHandler;
Returns the user’s last verified location token if still valid, or requests a fresh token if not.
Note that you must configure SSL pinning before calling this method.
A boolean indicating whether to range beacons.
desiredAccuracy
RadarTrackingOptionsDesiredAccuracy
required
The desired accuracy.
completionHandler
RadarTrackVerifiedCompletionHandler
An optional completion handler.
clearVerifiedLocationToken()
class func clearVerifiedLocationToken()
+ (void)clearVerifiedLocationToken;
Clears the user’s last verified location token.
setExpectedJurisdiction(countryCode:stateCode:)
class func setExpectedJurisdiction(countryCode: String?, stateCode: String?)
+ (void)setExpectedJurisdictionWithCountryCode:(NSString *)countryCode stateCode:(NSString *)stateCode;
Optionally sets the user’s expected country and state for jurisdiction checks.
The user’s expected two-letter country code.
The user’s expected two-letter state code.
Background Tracking
startTracking(trackingOptions:)
class func startTracking(trackingOptions: RadarTrackingOptions)
+ (void)startTrackingWithOptions:(RadarTrackingOptions *)options;
Starts tracking the user’s location in the background with configurable tracking options.
trackingOptions
RadarTrackingOptions
required
Configurable tracking options. Use preset options like RadarTrackingOptions.presetContinuous, RadarTrackingOptions.presetResponsive, or RadarTrackingOptions.presetEfficient, or create custom options.
mockTracking(origin:destination:mode:steps:interval:completionHandler:)
class func mockTracking(origin: CLLocation, destination: CLLocation, mode: RadarRouteMode, steps: Int32, interval: TimeInterval, completionHandler: RadarTrackCompletionHandler?)
+ (void)mockTrackingWithOrigin:(CLLocation *)origin
destination:(CLLocation *)destination
mode:(RadarRouteMode)mode
steps:(int)steps
interval:(NSTimeInterval)interval
completionHandler:(RadarTrackCompletionHandler)completionHandler;
Mocks tracking the user’s location from an origin to a destination.
The number of mock location updates.
The interval in seconds between each mock location update. A number between 1 and 60.
completionHandler
RadarTrackCompletionHandler
An optional completion handler.
stopTracking()
class func stopTracking()
Stops tracking the user’s location in the background.
isTracking()
class func isTracking() -> Bool
Returns a boolean indicating whether tracking has been started.
getTrackingOptions()
class func getTrackingOptions() -> RadarTrackingOptions
+ (RadarTrackingOptions *)getTrackingOptions;
Returns the current tracking options.
isUsingRemoteTrackingOptions()
class func isUsingRemoteTrackingOptions() -> Bool
+ (BOOL)isUsingRemoteTrackingOptions;
Returns a boolean indicating whether local tracking options are being overridden by remote tracking options.
Delegate
setDelegate(_:)
class func setDelegate(_ delegate: RadarDelegate?)
+ (void)setDelegate:(id<RadarDelegate>)delegate;
Sets a delegate for client-side delivery of events, location updates, and debug logs.
A delegate for client-side delivery of events, location updates, and debug logs. If nil, the previous delegate will be cleared.
setVerifiedDelegate(_:)
class func setVerifiedDelegate(_ verifiedDelegate: RadarVerifiedDelegate?)
+ (void)setVerifiedDelegate:(id<RadarVerifiedDelegate>)verifiedDelegate;
Sets a delegate for client-side delivery of verified location tokens.
A delegate for client-side delivery of verified location tokens. If nil, the previous delegate will be cleared.
Events
acceptEventId(_:verifiedPlaceId:)
class func acceptEventId(_ eventId: String, verifiedPlaceId: String?)
+ (void)acceptEventId:(NSString *)eventId verifiedPlaceId:(NSString *)verifiedPlaceId;
Accepts an event. Events can be accepted after user check-ins or other forms of verification. Event verifications will be used to improve the accuracy and confidence level of future events.
The ID of the event to accept.
For place entry events, the ID of the verified place. May be nil.
rejectEventId(_:)
class func rejectEventId(_ eventId: String)
+ (void)rejectEventId:(NSString *)eventId;
Rejects an event. Events can be rejected after user check-ins or other forms of verification. Event verifications will be used to improve the accuracy and confidence level of future events.
The ID of the event to reject.
class func logConversion(name: String, metadata: [AnyHashable: Any]?, completionHandler: RadarLogConversionCompletionHandler)
+ (void)logConversionWithName:(NSString *)name
metadata:(NSDictionary *)metadata
completionHandler:(RadarLogConversionCompletionHandler)completionHandler;
Logs a conversion.
The name of the conversion.
The metadata associated with the conversion.
completionHandler
RadarLogConversionCompletionHandler
required
A completion handler called when the request succeeds, fails, or times out.typealias RadarLogConversionCompletionHandler = (RadarStatus, RadarEvent?) -> Void
status: The request status
event: The conversion event generated, if successful
class func logConversion(name: String, revenue: NSNumber, metadata: [AnyHashable: Any]?, completionHandler: RadarLogConversionCompletionHandler)
+ (void)logConversionWithName:(NSString *)name
revenue:(NSNumber *)revenue
metadata:(NSDictionary *)metadata
completionHandler:(RadarLogConversionCompletionHandler)completionHandler;
Logs a conversion with revenue.
The name of the conversion.
The revenue generated by the conversion.
The metadata associated with the conversion.
completionHandler
RadarLogConversionCompletionHandler
required
A completion handler.
logConversion(request:)
class func logConversion(request: UNNotificationRequest?)
+ (void)logConversionWithNotification:(UNNotificationRequest *)request;
Logs a conversion with a notification.
The request associated with the notification.
logConversion(response:)
class func logConversion(response: UNNotificationResponse)
+ (void)logConversionWithNotificationResponse:(UNNotificationResponse *)response;
Logs a conversion with a notification. This should only be used to manually setup logging of notification conversions.
response
UNNotificationResponse
required
The response associated with user interaction with the notification.
Trips
getTripOptions()
class func getTripOptions() -> RadarTripOptions?
+ (RadarTripOptions *)getTripOptions;
Returns the current trip options.
getTrip()
class func getTrip() -> RadarTrip?
Returns the current trip, including legs for multi-destination trips. Use the legs’ _id values when calling updateTripLeg.
startTrip(options:)
class func startTrip(options: RadarTripOptions)
+ (void)startTripWithOptions:(RadarTripOptions *)options;
Starts a trip.
Configurable trip options.
startTrip(options:completionHandler:)
class func startTrip(options: RadarTripOptions, completionHandler: RadarTripCompletionHandler?)
+ (void)startTripWithOptions:(RadarTripOptions *)options
completionHandler:(RadarTripCompletionHandler)completionHandler;
Starts a trip.
Configurable trip options.
completionHandler
RadarTripCompletionHandler
An optional completion handler called when the request succeeds, fails, or times out.typealias RadarTripCompletionHandler = (RadarStatus, RadarTrip?, [RadarEvent]?) -> Void
status: The request status
trip: The trip, if successful
events: An array of events generated, if any
startTrip(options:trackingOptions:completionHandler:)
class func startTrip(options: RadarTripOptions, trackingOptions: RadarTrackingOptions?, completionHandler: RadarTripCompletionHandler?)
+ (void)startTripWithOptions:(RadarTripOptions *)tripOptions
trackingOptions:(RadarTrackingOptions *)trackingOptions
completionHandler:(RadarTripCompletionHandler)completionHandler;
Starts a trip.
Configurable trip options.
Tracking options to use during the trip.
completionHandler
RadarTripCompletionHandler
An optional completion handler.
updateTrip(options:status:completionHandler:)
class func updateTrip(options: RadarTripOptions, status: RadarTripStatus, completionHandler: RadarTripCompletionHandler?)
+ (void)updateTripWithOptions:(RadarTripOptions *)options
status:(RadarTripStatus)status
completionHandler:(RadarTripCompletionHandler)completionHandler;
Manually updates a trip.
Configurable trip options.
The trip status. To avoid updating status, pass RadarTripStatus.unknown.
completionHandler
RadarTripCompletionHandler
An optional completion handler.
completeTrip()
class func completeTrip()
Completes a trip.
completeTrip(completionHandler:)
class func completeTrip(completionHandler: RadarTripCompletionHandler?)
+ (void)completeTripWithCompletionHandler:(RadarTripCompletionHandler)completionHandler;
Completes a trip.
completionHandler
RadarTripCompletionHandler
An optional completion handler.
cancelTrip()
Cancels a trip.
cancelTrip(completionHandler:)
class func cancelTrip(completionHandler: RadarTripCompletionHandler?)
+ (void)cancelTripWithCompletionHandler:(RadarTripCompletionHandler)completionHandler;
Cancels a trip.
completionHandler
RadarTripCompletionHandler
An optional completion handler.
updateTripLeg(tripId:legId:status:completionHandler:)
class func updateTripLeg(tripId: String, legId: String, status: RadarTripLegStatus, completionHandler: RadarTripLegCompletionHandler?)
+ (void)updateTripLegWithTripId:(NSString *)tripId
legId:(NSString *)legId
status:(RadarTripLegStatus)status
completionHandler:(RadarTripLegCompletionHandler)completionHandler;
Updates a trip leg status for multi-destination trips.
The Radar ID of the trip (from RadarTrip._id).
The Radar ID of the leg (from RadarTripLeg._id).
status
RadarTripLegStatus
required
The new status for the leg.
completionHandler
RadarTripLegCompletionHandler
An optional completion handler called when the request succeeds, fails, or times out.typealias RadarTripLegCompletionHandler = (RadarStatus, RadarTrip?, RadarTripLeg?, [RadarEvent]?) -> Void
status: The request status
trip: The trip, if successful
leg: The updated leg, if successful
events: An array of events generated, if any
updateTripLeg(legId:status:completionHandler:)
class func updateTripLeg(legId: String, status: RadarTripLegStatus, completionHandler: RadarTripLegCompletionHandler?)
+ (void)updateTripLegWithLegId:(NSString *)legId
status:(RadarTripLegStatus)status
completionHandler:(RadarTripLegCompletionHandler)completionHandler;
Updates a trip leg status for multi-destination trips, using the current trip’s ID.
The Radar ID of the leg (from RadarTripLeg._id).
status
RadarTripLegStatus
required
The new status for the leg.
completionHandler
RadarTripLegCompletionHandler
An optional completion handler.
updateCurrentTripLeg(status:completionHandler:)
class func updateCurrentTripLeg(status: RadarTripLegStatus, completionHandler: RadarTripLegCompletionHandler?)
+ (void)updateCurrentTripLegWithStatus:(RadarTripLegStatus)status
completionHandler:(RadarTripLegCompletionHandler)completionHandler;
Updates the current trip leg status for multi-destination trips. Uses the current trip’s ID and currentLegId automatically.
status
RadarTripLegStatus
required
The new status for the current leg.
completionHandler
RadarTripLegCompletionHandler
An optional completion handler.
reorderTripLegs(tripId:legIds:completionHandler:)
class func reorderTripLegs(tripId: String, legIds: [String], completionHandler: RadarTripCompletionHandler?)
+ (void)reorderTripLegsWithTripId:(NSString *)tripId
legIds:(NSArray<NSString *> *)legIds
completionHandler:(RadarTripCompletionHandler)completionHandler;
Reorders the legs of a multi-destination trip.
The Radar ID of the trip (from RadarTrip._id).
An array of leg IDs in the desired new order.
completionHandler
RadarTripCompletionHandler
An optional completion handler.
reorderTripLegs(legIds:completionHandler:)
class func reorderTripLegs(legIds: [String], completionHandler: RadarTripCompletionHandler?)
+ (void)reorderTripLegsWithLegIds:(NSArray<NSString *> *)legIds
completionHandler:(RadarTripCompletionHandler)completionHandler;
Reorders the legs of the current multi-destination trip.
An array of leg IDs in the desired new order.
completionHandler
RadarTripCompletionHandler
An optional completion handler.
Context
getContext(completionHandler:)
class func getContext(completionHandler: RadarContextCompletionHandler)
+ (void)getContextWithCompletionHandler:(RadarContextCompletionHandler)completionHandler;
Gets the device’s current location, then gets context for that location without sending device or user identifiers to the server.
completionHandler
RadarContextCompletionHandler
required
A completion handler called when the request succeeds, fails, or times out.typealias RadarContextCompletionHandler = (RadarStatus, CLLocation?, RadarContext?) -> Void
status: The request status
location: The location, if successful
context: The context, if successful
getContext(location:completionHandler:)
class func getContext(location: CLLocation, completionHandler: RadarContextCompletionHandler)
+ (void)getContextForLocation:(CLLocation *)location
completionHandler:(RadarContextCompletionHandler)completionHandler;
Gets context for a location without sending device or user identifiers to the server.
completionHandler
RadarContextCompletionHandler
required
A completion handler.
Search
searchPlaces(radius:chains:categories:groups:countryCodes:limit:completionHandler:)
class func searchPlaces(radius: Int32, chains: [String]?, categories: [String]?, groups: [String]?, countryCodes: [String]?, limit: Int32, completionHandler: RadarSearchPlacesCompletionHandler)
+ (void)searchPlacesWithRadius:(int)radius
chains:(NSArray<NSString *> *)chains
categories:(NSArray<NSString *> *)categories
groups:(NSArray<NSString *> *)groups
countryCodes:(NSArray<NSString *> *)countryCodes
limit:(int)limit
completionHandler:(RadarSearchPlacesCompletionHandler)completionHandler;
Gets the device’s current location, then searches for places near that location, sorted by distance.
You may specify only one of chains, categories, or groups.
The radius to search, in meters. A number between 100 and 10000.
An array of chain slugs to filter. See Chains.
An array of groups to filter. See Groups.
An array of country codes to filter. See Countries.
The max number of places to return. A number between 1 and 100.
completionHandler
RadarSearchPlacesCompletionHandler
required
A completion handler called when the request succeeds, fails, or times out.typealias RadarSearchPlacesCompletionHandler = (RadarStatus, CLLocation?, [RadarPlace]?) -> Void
status: The request status
location: The location, if successful
places: An array of places sorted by distance, if successful
class func searchPlaces(radius: Int32, chains: [String]?, chainMetadata: [String: String]?, categories: [String]?, groups: [String]?, countryCodes: [String]?, limit: Int32, completionHandler: RadarSearchPlacesCompletionHandler)
+ (void)searchPlacesWithRadius:(int)radius
chains:(NSArray<NSString *> *)chains
chainMetadata:(NSDictionary<NSString *, NSString *> *)chainMetadata
categories:(NSArray<NSString *> *)categories
groups:(NSArray<NSString *> *)groups
countryCodes:(NSArray<NSString *> *)countryCodes
limit:(int)limit
completionHandler:(RadarSearchPlacesCompletionHandler)completionHandler;
Gets the device’s current location, then searches for places near that location, sorted by distance.
You may specify only one of chains, categories, or groups; if chains are specified, chainMetadata can also be specified.
The radius to search, in meters. A number between 100 and 10000.
An array of chain slugs to filter.
chainMetadata
Dictionary<String, String>
Optional chain metadata filters. Keys and values must be strings.
An array of categories to filter.
An array of groups to filter.
An array of country codes to filter.
The max number of places to return. A number between 1 and 100.
completionHandler
RadarSearchPlacesCompletionHandler
required
A completion handler.
searchPlaces(near:radius:chains:categories:groups:countryCodes:limit:completionHandler:)
class func searchPlaces(near: CLLocation, radius: Int32, chains: [String]?, categories: [String]?, groups: [String]?, countryCodes: [String]?, limit: Int32, completionHandler: RadarSearchPlacesCompletionHandler)
+ (void)searchPlacesNear:(CLLocation *)near
radius:(int)radius
chains:(NSArray<NSString *> *)chains
categories:(NSArray<NSString *> *)categories
groups:(NSArray<NSString *> *)groups
countryCodes:(NSArray<NSString *> *)countryCodes
limit:(int)limit
completionHandler:(RadarSearchPlacesCompletionHandler)completionHandler;
Searches for places near a location, sorted by distance.
You may specify only one of chains, categories, or groups.
The radius to search, in meters. A number between 100 and 10000.
An array of chain slugs to filter.
An array of categories to filter.
An array of groups to filter.
An array of country codes to filter.
The max number of places to return. A number between 1 and 100.
completionHandler
RadarSearchPlacesCompletionHandler
required
A completion handler.
class func searchPlaces(near: CLLocation, radius: Int32, chains: [String]?, chainMetadata: [String: String]?, categories: [String]?, groups: [String]?, countryCodes: [String]?, limit: Int32, completionHandler: RadarSearchPlacesCompletionHandler)
+ (void)searchPlacesNear:(CLLocation *)near
radius:(int)radius
chains:(NSArray<NSString *> *)chains
chainMetadata:(NSDictionary<NSString *, NSString *> *)chainMetadata
categories:(NSArray<NSString *> *)categories
groups:(NSArray<NSString *> *)groups
countryCodes:(NSArray<NSString *> *)countryCodes
limit:(int)limit
completionHandler:(RadarSearchPlacesCompletionHandler)completionHandler;
Searches for places near a location, sorted by distance.
You may specify only one of chains, categories, or groups.
The radius to search, in meters. A number between 100 and 10000.
An array of chain slugs to filter.
chainMetadata
Dictionary<String, String>
Optional chain metadata filters.
An array of categories to filter.
An array of groups to filter.
An array of country codes to filter.
The max number of places to return. A number between 1 and 100.
completionHandler
RadarSearchPlacesCompletionHandler
required
A completion handler.
searchGeofences(completionHandler:)
class func searchGeofences(completionHandler: RadarSearchGeofencesCompletionHandler)
+ (void)searchGeofences:(RadarSearchGeofencesCompletionHandler)completionHandler;
Gets the device’s current location, then searches for geofences near that location, sorted by distance.
completionHandler
RadarSearchGeofencesCompletionHandler
required
A completion handler called when the request succeeds, fails, or times out.typealias RadarSearchGeofencesCompletionHandler = (RadarStatus, CLLocation?, [RadarGeofence]?) -> Void
status: The request status
location: The location, if successful
geofences: An array of geofences sorted by distance, if successful
class func searchGeofences(near: CLLocation?, radius: Int32, tags: [String]?, metadata: [AnyHashable: Any]?, limit: Int32, includeGeometry: Bool, completionHandler: RadarSearchGeofencesCompletionHandler)
+ (void)searchGeofencesNear:(CLLocation *)near
radius:(int)radius
tags:(NSArray<NSString *> *)tags
metadata:(NSDictionary *)metadata
limit:(int)limit
includeGeometry:(BOOL)includeGeometry
completionHandler:(RadarSearchGeofencesCompletionHandler)completionHandler;
Searches for geofences near a location, sorted by distance.
The location to search. Use nil to search near the device’s current location.
The radius to search, in meters. A number between 100 and 10000. If -1 is entered, the server defaults to using unlimited radius.
An array of tags to filter.
A dictionary of metadata to filter.
The max number of geofences to return. A number between 1 and 1000. Defaults to 100.
Include geofence geometries in the response. Recommended to be set to false unless you specifically need the geometries. To retrieve more than 100 results, includeGeometry must be set to false.
completionHandler
RadarSearchGeofencesCompletionHandler
required
A completion handler.
autocomplete(query:near:layers:limit:country:mailable:completionHandler:)
class func autocomplete(query: String, near: CLLocation?, layers: [String]?, limit: Int32, country: String?, mailable: Bool, completionHandler: RadarGeocodeCompletionHandler)
+ (void)autocompleteQuery:(NSString *)query
near:(CLLocation *)near
layers:(NSArray<NSString *> *)layers
limit:(int)limit
country:(NSString *)country
mailable:(BOOL)mailable
completionHandler:(RadarGeocodeCompletionHandler)completionHandler;
Autocompletes partial addresses and place names, sorted by relevance.
The partial address or place name to autocomplete.
A location for the search.
The max number of addresses to return. A number between 1 and 100.
An optional country filter. A string, the unique 2-letter country code.
Whether to only include mailable addresses.
completionHandler
RadarGeocodeCompletionHandler
required
A completion handler called when the request succeeds, fails, or times out.typealias RadarGeocodeCompletionHandler = (RadarStatus, [RadarAddress]?) -> Void
status: The request status
addresses: The geocoding results (an array of addresses), if successful
autocomplete(query:near:layers:limit:country:completionHandler:)
class func autocomplete(query: String, near: CLLocation?, layers: [String]?, limit: Int32, country: String?, completionHandler: RadarGeocodeCompletionHandler)
+ (void)autocompleteQuery:(NSString *)query
near:(CLLocation *)near
layers:(NSArray<NSString *> *)layers
limit:(int)limit
country:(NSString *)country
completionHandler:(RadarGeocodeCompletionHandler)completionHandler;
Autocompletes partial addresses and place names, sorted by relevance.
The partial address or place name to autocomplete.
A location for the search.
The max number of addresses to return. A number between 1 and 100.
An optional country filter.
completionHandler
RadarGeocodeCompletionHandler
required
A completion handler.
autocomplete(query:near:limit:completionHandler:)
class func autocomplete(query: String, near: CLLocation?, limit: Int32, completionHandler: RadarGeocodeCompletionHandler)
+ (void)autocompleteQuery:(NSString *)query
near:(CLLocation *)near
limit:(int)limit
completionHandler:(RadarGeocodeCompletionHandler)completionHandler;
Autocompletes partial addresses and place names, sorted by relevance.
The partial address or place name to autocomplete.
A location for the search.
The max number of addresses to return. A number between 1 and 100.
completionHandler
RadarGeocodeCompletionHandler
required
A completion handler.
Geocoding
geocode(address:completionHandler:)
class func geocode(address: String, completionHandler: RadarGeocodeCompletionHandler)
+ (void)geocodeAddress:(NSString *)query completionHandler:(RadarGeocodeCompletionHandler)completionHandler;
Geocodes an address, converting address to coordinates.
completionHandler
RadarGeocodeCompletionHandler
required
A completion handler.
geocode(address:layers:countries:completionHandler:)
class func geocode(address: String, layers: [String]?, countries: [String]?, completionHandler: RadarGeocodeCompletionHandler)
+ (void)geocodeAddress:(NSString *)query
layers:(NSArray<NSString *> *)layers
countries:(NSArray<NSString *> *)countries
completionHandler:(RadarGeocodeCompletionHandler)completionHandler;
Geocodes an address, converting address to coordinates.
Optional country filters. A string array of unique 2-letter country codes.
completionHandler
RadarGeocodeCompletionHandler
required
A completion handler.
reverseGeocode(completionHandler:)
class func reverseGeocode(completionHandler: RadarGeocodeCompletionHandler)
+ (void)reverseGeocodeWithCompletionHandler:(RadarGeocodeCompletionHandler)completionHandler;
Gets the device’s current location, then reverse geocodes that location, converting coordinates to address.
completionHandler
RadarGeocodeCompletionHandler
required
A completion handler.
reverseGeocode(layers:completionHandler:)
class func reverseGeocode(layers: [String]?, completionHandler: RadarGeocodeCompletionHandler)
+ (void)reverseGeocodeWithLayers:(NSArray<NSString *> *)layers
completionHandler:(RadarGeocodeCompletionHandler)completionHandler;
Gets the device’s current location, then reverse geocodes that location, converting coordinates to address.
completionHandler
RadarGeocodeCompletionHandler
required
A completion handler.
reverseGeocode(location:completionHandler:)
class func reverseGeocode(location: CLLocation, completionHandler: RadarGeocodeCompletionHandler)
+ (void)reverseGeocodeLocation:(CLLocation *)location
completionHandler:(RadarGeocodeCompletionHandler)completionHandler;
Reverse geocodes a location, converting coordinates to address.
The location to reverse geocode.
completionHandler
RadarGeocodeCompletionHandler
required
A completion handler.
reverseGeocode(location:layers:completionHandler:)
class func reverseGeocode(location: CLLocation, layers: [String]?, completionHandler: RadarGeocodeCompletionHandler)
+ (void)reverseGeocodeLocation:(CLLocation *)location
layers:(NSArray<NSString *> *)layers
completionHandler:(RadarGeocodeCompletionHandler)completionHandler;
Reverse geocodes a location, converting coordinates to address.
The location to reverse geocode.
completionHandler
RadarGeocodeCompletionHandler
required
A completion handler.
ipGeocode(completionHandler:)
class func ipGeocode(completionHandler: RadarIPGeocodeCompletionHandler)
+ (void)ipGeocodeWithCompletionHandler:(RadarIPGeocodeCompletionHandler)completionHandler;
Geocodes the device’s current IP address, converting IP address to partial address.
completionHandler
RadarIPGeocodeCompletionHandler
required
A completion handler called when the request succeeds, fails, or times out.typealias RadarIPGeocodeCompletionHandler = (RadarStatus, RadarAddress?, Bool) -> Void
status: The request status
address: The geocoding result (a partial address), if successful
proxy: A boolean indicating whether the IP address is a known proxy
validateAddress(address:completionHandler:)
class func validateAddress(address: RadarAddress, completionHandler: RadarValidateAddressCompletionHandler)
+ (void)validateAddress:(RadarAddress *)address completionHandler:(RadarValidateAddressCompletionHandler)completionHandler;
Validates an address, attaching a verification status, property type, and ZIP+4.
completionHandler
RadarValidateAddressCompletionHandler
required
A completion handler called when the request succeeds, fails, or times out.typealias RadarValidateAddressCompletionHandler = (RadarStatus, RadarAddress?, RadarAddressVerificationStatus) -> Void
status: The request status
address: The validated address, if successful
verificationStatus: The verification status
Distance
getDistance(destination:modes:units:completionHandler:)
class func getDistance(destination: CLLocation, modes: RadarRouteMode, units: RadarRouteUnits, completionHandler: RadarRouteCompletionHandler)
+ (void)getDistanceToDestination:(CLLocation *)destination
modes:(RadarRouteMode)modes
units:(RadarRouteUnits)units
completionHandler:(RadarRouteCompletionHandler)completionHandler;
Gets the device’s current location, then calculates the travel distance and duration to a destination.
The distance units (.imperial or .metric).
completionHandler
RadarRouteCompletionHandler
required
A completion handler called when the request succeeds, fails, or times out.typealias RadarRouteCompletionHandler = (RadarStatus, RadarRoutes?) -> Void
status: The request status
routes: The routes, if successful
getDistance(origin:destination:modes:units:completionHandler:)
class func getDistance(origin: CLLocation, destination: CLLocation, modes: RadarRouteMode, units: RadarRouteUnits, completionHandler: RadarRouteCompletionHandler)
+ (void)getDistanceFromOrigin:(CLLocation *)origin
destination:(CLLocation *)destination
modes:(RadarRouteMode)modes
units:(RadarRouteUnits)units
completionHandler:(RadarRouteCompletionHandler)completionHandler;
Calculates the travel distance and duration from an origin to a destination.
completionHandler
RadarRouteCompletionHandler
required
A completion handler.
getMatrix(origins:destinations:mode:units:completionHandler:)
class func getMatrix(origins: [CLLocation], destinations: [CLLocation], mode: RadarRouteMode, units: RadarRouteUnits, completionHandler: RadarRouteMatrixCompletionHandler)
+ (void)getMatrixFromOrigins:(NSArray<CLLocation *> *)origins
destinations:(NSArray<CLLocation *> *)destinations
mode:(RadarRouteMode)mode
units:(RadarRouteUnits)units
completionHandler:(RadarRouteMatrixCompletionHandler)completionHandler;
Calculates the travel distances and durations between multiple origins and destinations for up to 25 routes.
origins
Array<CLLocation>
required
The origins.
destinations
Array<CLLocation>
required
The destinations.
completionHandler
RadarRouteMatrixCompletionHandler
required
A completion handler called when the request succeeds, fails, or times out.typealias RadarRouteMatrixCompletionHandler = (RadarStatus, RadarRouteMatrix?) -> Void
status: The request status
matrix: The matrix, if successful
Logging
setLogLevel(_:)
class func setLogLevel(_ level: RadarLogLevel)
+ (void)setLogLevel:(RadarLogLevel)level;
Sets the preferred log level for debug logs. This can be overridden by the remote SDK configuration set in the dashboard.
The log level (.none, .error, .warning, .info, or .debug).
logTermination()
class func logTermination()
Log application terminating. Include this in your application delegate’s applicationWillTerminate: method.
logBackgrounding()
class func logBackgrounding()
+ (void)logBackgrounding;
Log application entering background. Include this in your application delegate’s applicationDidEnterBackground: method.
logResigningActive()
class func logResigningActive()
+ (void)logResigningActive;
Log application resigning active. Include this in your application delegate’s applicationWillResignActive: method.
Helpers
stringForStatus(_:)
class func stringForStatus(_ status: RadarStatus) -> String
+ (NSString *)stringForStatus:(RadarStatus)status;
Returns a display string for a status value.
stringForVerificationStatus(_:)
class func stringForVerificationStatus(_ verificationStatus: RadarAddressVerificationStatus) -> String
+ (NSString *)stringForVerificationStatus:(RadarAddressVerificationStatus)verificationStatus;
Returns a string for address validation status value.
verificationStatus
RadarAddressVerificationStatus
required
An address verification status value.
stringForActivityType(_:)
class func stringForActivityType(_ type: RadarActivityType) -> String
+ (NSString *)stringForActivityType:(RadarActivityType)type;
Returns a display string for an activity type value.
type
RadarActivityType
required
An activity type value.
stringForLocationSource(_:)
class func stringForLocationSource(_ source: RadarLocationSource) -> String
+ (NSString *)stringForLocationSource:(RadarLocationSource)source;
Returns a display string for a location source value.
source
RadarLocationSource
required
A location source value.
class func stringForMode(_ mode: RadarRouteMode) -> String
+ (NSString *)stringForMode:(RadarRouteMode)mode;
Returns a display string for a travel mode value.
stringForTripStatus(_:)
class func stringForTripStatus(_ status: RadarTripStatus) -> String
+ (NSString *)stringForTripStatus:(RadarTripStatus)status;
Returns a display string for a trip status value.
dictionaryForLocation(_:)
class func dictionaryForLocation(_ location: CLLocation) -> [AnyHashable: Any]
+ (NSDictionary *)dictionaryForLocation:(CLLocation *)location;
Returns a dictionary for a location.
dictionaryForInAppMessage(_:)
class func dictionaryForInAppMessage(_ message: RadarInAppMessage) -> [AnyHashable: Any]
+ (NSDictionary *)dictionaryForInAppMessage:(RadarInAppMessage *)message;
Returns a dictionary for an in-app message.
message
RadarInAppMessage
required
An in-app message.