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.

  • Returns the current publishable API key.

    Declaration

    Objective-C

    + (NSString *_Nullable)getPublishableKey;

    Swift

    class func getPublishableKey() -> String?

    Return Value

    The current 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

    Before calling this method, the user’s location authorization status should be kCLAuthorizationStatusAuthorizedWhenInUse or kCLAuthorizationStatusAuthorizedAlways. 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.

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