Radar

@interface Radar : NSObject

The main class used to interact with the Radar SDK.

  • Initializes the Radar SDK.

    Warning

    Call this method from the main thread in your AppDelegate class before calling any other Radar methods.

    Declaration

    Objective-C

    + (void)initializeWithPublishableKey:(NSString *_Nonnull)publishableKey;

    Swift

    class func initialize(publishableKey: String)

    Parameters

    publishableKey

    Your publishable API key.

  • Identifies the user.

    Note

    Until you identify the user, Radar will automatically identify the user by deviceId (IDFV).

    Declaration

    Objective-C

    + (void)setUserId:(NSString *_Nullable)userId;

    Swift

    class func setUserId(_ userId: String?)

    Parameters

    userId

    A stable unique ID for the user. If nil, the previous userId will be cleared.

  • Returns the current userId.

    Declaration

    Objective-C

    + (NSString *_Nullable)getUserId;

    Swift

    class func getUserId() -> String?

    Return Value

    The current userId.

  • Sets an optional description for the user, displayed in the dashboard.

    Declaration

    Objective-C

    + (void)setDescription:(NSString *_Nullable)description;

    Swift

    class func setDescription(_ description: String?)

    Parameters

    description

    A description for the user. If nil, the previous description will be cleared.

  • Returns the current description.

    Declaration

    Objective-C

    + (NSString *_Nullable)getDescription;

    Swift

    class func getDescription() -> String?

    Return Value

    The current description.

  • Sets an optional set of custom key-value pairs for the user.

    Declaration

    Objective-C

    + (void)setMetadata:(NSDictionary *_Nullable)metadata;

    Swift

    class func setMetadata(_ metadata: [AnyHashable : Any]?)

    Parameters

    metadata

    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.

  • Returns the current metadata.

    Declaration

    Objective-C

    + (NSDictionary *_Nullable)getMetadata;

    Swift

    class func getMetadata() -> [AnyHashable : Any]?

    Return Value

    The current metadata.

  • Gets the device’s current location.

    Declaration

    Objective-C

    + (void)getLocationWithCompletionHandler:
        (RadarLocationCompletionHandler _Nullable)completionHandler;

    Swift

    class func getLocation(completionHandler: RadarLocationCompletionHandler? = nil)

    Parameters

    completionHandler

    An optional completion handler.

  • Tracks the user’s location once in the foreground.

    Warning

    Note that these calls are subject to rate limits.

    Declaration

    Objective-C

    + (void)trackOnceWithCompletionHandler:
        (RadarTrackCompletionHandler _Nullable)completionHandler;

    Swift

    class func trackOnce(completionHandler: RadarTrackCompletionHandler? = nil)

    Parameters

    completionHandler

    An optional completion handler.

  • Manually updates the user’s location.

    Warning

    Note that these calls are subject to rate limits.

    Declaration

    Objective-C

    + (void)trackOnceWithLocation:(CLLocation *_Nonnull)location
                completionHandler:
                    (RadarTrackCompletionHandler _Nullable)completionHandler;

    Swift

    class func trackOnce(location: CLLocation, completionHandler: RadarTrackCompletionHandler? = nil)

    Parameters

    location

    A location for the user.

    completionHandler

    An optional completion handler.

  • Starts tracking the user’s location in the background.

    Warning

    Before calling this method, the user’s location authorization status must be kCLAuthorizationStatusAuthorizedAlways.

    Declaration

    Objective-C

    + (void)startTracking;

    Swift

    class func startTracking()
  • Starts tracking the user’s location in the background with configurable tracking options.

    Warning

    Before calling this method, the user’s location authorization status should be kCLAuthorizationStatusAuthorizedAlways.

    Declaration

    Objective-C

    + (void)startTrackingWithOptions:(nonnull RadarTrackingOptions *)options;

    Swift

    class func startTracking(trackingOptions options: RadarTrackingOptions)

    Parameters

    options

    Configurable tracking options.

  • Stops tracking the user’s location in the background.

    Declaration

    Objective-C

    + (void)stopTracking;

    Swift

    class func stopTracking()
  • Returns a boolean indicating whether tracking has been started.

    Declaration

    Objective-C

    + (BOOL)isTracking;

    Swift

    class func isTracking() -> Bool

    Return Value

    A boolean indicating whether tracking has been started.

  • Returns the current tracking options.

    Declaration

    Objective-C

    + (nonnull RadarTrackingOptions *)getTrackingOptions;

    Swift

    class func getTrackingOptions() -> RadarTrackingOptions

    Return Value

    The current tracking options.

  • Sets a delegate for client-side delivery of events, location updates, and debug logs.

    Declaration

    Objective-C

    + (void)setDelegate:(nullable id<RadarDelegate>)delegate;

    Parameters

    delegate

    A delegate for client-side delivery of events, location updates, and debug logs. If nil, the previous delegate will be cleared.

  • 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.

    Declaration

    Objective-C

    + (void)acceptEventId:(NSString *_Nonnull)eventId
          verifiedPlaceId:(NSString *_Nullable)verifiedPlaceId;

    Swift

    class func acceptEventId(_ eventId: String, verifiedPlaceId: String?)

    Parameters

    eventId

    The ID of the event to accept.

    verifiedPlaceId

    For place entry events, the ID of the verified place. May be nil.

  • Rejects 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.

    Declaration

    Objective-C

    + (void)rejectEventId:(NSString *_Nonnull)eventId;

    Swift

    class func rejectEventId(_ eventId: String)

    Parameters

    eventId

    The ID of the event to reject.

  • Gets the device’s current location, then searches for places near that location, sorted by distance.

    Warning

    You may specify only one of chains, categories, or groups.

    Declaration

    Objective-C

    + (void)searchPlacesWithRadius:(int)radius
                            chains:(NSArray *_Nullable)chains
                        categories:(NSArray *_Nullable)categories
                            groups:(NSArray *_Nullable)groups
                             limit:(int)limit
                 completionHandler:
                     (RadarSearchPlacesCompletionHandler)completionHandler;

    Swift

    class func searchPlaces(radius: Int32, chains: [Any]?, categories: [Any]?, groups: [Any]?, limit: Int32, completionHandler: @escaping RadarSearchPlacesCompletionHandler)

    Parameters

    radius

    The radius to search, in meters. A number between 100 and 10000.

    chains

    An array of chain slugs to filter. See https://radar.io/documentation/places/chains

    categories

    An array of categories to filter. See: https://radar.io/documentation/places/categories

    groups

    An array of groups to filter. See https://radar.io/documentation/places/groups

    limit

    The max number of places to return. A number between 1 and 100.

    completionHandler

    A completion handler.

  • Searches for places near a location, sorted by distance.

    Warning

    You may specify only one of chains, categories, or groups.

    Declaration

    Objective-C

    + (void)searchPlacesWithLocation:(nonnull CLLocation *)location
                              radius:(int)radius
                              chains:(NSArray *_Nullable)chains
                          categories:(NSArray *_Nullable)categories
                              groups:(NSArray *_Nullable)groups
                               limit:(int)limit
                   completionHandler:
                       (RadarSearchPlacesCompletionHandler)completionHandler;

    Swift

    class func searchPlaces(location: CLLocation, radius: Int32, chains: [Any]?, categories: [Any]?, groups: [Any]?, limit: Int32, completionHandler: @escaping RadarSearchPlacesCompletionHandler)

    Parameters

    location

    The location to search.

    radius

    The radius to search, in meters. A number between 100 and 10000.

    chains

    An array of chain slugs to filter. See https://radar.io/documentation/places/chains

    categories

    An array of categories to filter. See: https://radar.io/documentation/places/categories

    groups

    An array of groups to filter. See https://radar.io/documentation/places/groups

    limit

    The max number of places to return. A number between 1 and 100.

    completionHandler

    A completion handler.

  • Gets the device’s current location, then searches for geofences near that location, sorted by distance.

    Declaration

    Objective-C

    + (void)searchGeofencesWithRadius:(int)radius
                                 tags:(NSArray *_Nullable)tags
                                limit:(int)limit
                    completionHandler:
                        (RadarSearchGeofencesCompletionHandler)completionHandler;

    Swift

    class func searchGeofences(radius: Int32, tags: [Any]?, limit: Int32, completionHandler: @escaping RadarSearchGeofencesCompletionHandler)

    Parameters

    radius

    The radius to search, in meters. A number between 100 and 10000.

    tags

    An array of tags to filter. See https://radar.io/documentation/geofences

    limit

    The max number of geofences to return. A number between 1 and 100.

    completionHandler

    A completion handler.

  • Searches for geofences near a location, sorted by distance.

    Declaration

    Objective-C

    + (void)searchGeofencesWithLocation:(nonnull CLLocation *)location
                                 radius:(int)radius
                                   tags:(NSArray *_Nullable)tags
                                  limit:(int)limit
                      completionHandler:
                          (RadarSearchGeofencesCompletionHandler)completionHandler;

    Swift

    class func searchGeofences(location: CLLocation, radius: Int32, tags: [Any]?, limit: Int32, completionHandler: @escaping RadarSearchGeofencesCompletionHandler)

    Parameters

    location

    The location to search.

    radius

    The radius to search, in meters. A number between 100 and 10000.

    tags

    An array of tags to filter. See https://radar.io/documentation/geofences

    limit

    The max number of geofences to return. A number between 1 and 100.

    completionHandler

    A completion handler.

  • Geocodes an address, converting address to coordinates.

    Declaration

    Objective-C

    + (void)geocodeAddress:(NSString *_Nonnull)query
         completionHandler:(RadarGeocodeCompletionHandler)completionHandler;

    Swift

    class func geocode(address query: String, completionHandler: @escaping RadarGeocodeCompletionHandler)

    Parameters

    query

    The address to geocode.

    completionHandler

    A completion handler.

  • Gets the device’s current location, then reverse geocodes that location, converting coordinates to address.

    Declaration

    Objective-C

    + (void)reverseGeocodeWithCompletionHandler:
        (RadarGeocodeCompletionHandler)completionHandler;

    Swift

    class func reverseGeocode(completionHandler: @escaping RadarGeocodeCompletionHandler)

    Parameters

    completionHandler

    A completion handler.

  • Reverse geocodes a location, converting coordinates to address.

    Declaration

    Objective-C

    + (void)reverseGeocodeLocation:(CLLocation *_Nonnull)location
                 completionHandler:(RadarGeocodeCompletionHandler)completionHandler;

    Swift

    class func reverseGeocode(location: CLLocation, completionHandler: @escaping RadarGeocodeCompletionHandler)

    Parameters

    location

    The location to reverse geocode.

    completionHandler

    A completion handler.

  • Geocodes the device’s current IP address, converting IP address to country.

    Declaration

    Objective-C

    + (void)ipGeocodeWithCompletionHandler:
        (RadarIPGeocodeCompletionHandler)completionHandler;

    Swift

    class func ipGeocode(completionHandler: @escaping RadarIPGeocodeCompletionHandler)

    Parameters

    completionHandler

    A completion handler.

  • Sets the log level for debug logs.

    Declaration

    Objective-C

    + (void)setLogLevel:(RadarLogLevel)level;

    Swift

    class func setLogLevel(_ level: RadarLogLevel)

    Parameters

    level

    The log level.

  • Returns a display string for a status value.

    Declaration

    Objective-C

    + (nonnull NSString *)stringForStatus:(RadarStatus)status;

    Swift

    class func stringForStatus(_ status: RadarStatus) -> String

    Parameters

    status

    A status value.

    Return Value

    A display string for the status value.

  • Returns a display string for a location source value.

    Declaration

    Objective-C

    + (nonnull NSString *)stringForSource:(RadarLocationSource)source;

    Swift

    class func stringForSource(_ source: RadarLocationSource) -> String

    Parameters

    source

    A location source value.

    Return Value

    A display string for the location source value.