Radar

Objective-C

@interface Radar : NSObject

Swift

class Radar : NSObject

The main class used to interact with the Radar SDK.

Initialization

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

Properties

  • Gets the version number of the Radar SDK, such as “3.5.1” or “3.5.1-beta.2”.

    Declaration

    Objective-C

    @property (class, readonly) NSString *_Nonnull sdkVersion;

    Swift

    class var sdkVersion: String { get }
  • 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.

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

  • Enables adId (IDFA) collection. Disabled by default.

    Declaration

    Objective-C

    + (void)setAdIdEnabled:(BOOL)enabled;

    Swift

    class func setAdIdEnabled(_ enabled: Bool)

    Parameters

    enabled

    A boolean indicating whether adId should be collected.

Get Location

Tracking

Delegation

Events

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

  • Declaration

    Objective-C

    + (void)sendEvent:(nonnull NSString *)customType
             withMetadata:(NSDictionary *_Nullable)metadata
        completionHandler:(RadarSendEventCompletionHandler)completionHandler;

    Swift

    class func sendEvent(customType: String, metadata: [AnyHashable : Any]?) async -> (RadarStatus, CLLocation?, [RadarEvent]?, RadarUser?)

    Parameters

    customType

    The user-defined type of the event.

    metadata

    The metadata associated with the event.

    completionHandler

    A completion handler.

  • Sends a custom event with a manually provided location.

    Declaration

    Objective-C

    + (void)sendEvent:(nonnull NSString *)customType
             withLocation:(CLLocation *_Nullable)location
                 metadata:(NSDictionary *_Nullable)metadata
        completionHandler:(RadarSendEventCompletionHandler)completionHandler;

    Swift

    class func sendEvent(customType: String, location: CLLocation?, metadata: [AnyHashable : Any]?) async -> (RadarStatus, CLLocation?, [RadarEvent]?, RadarUser?)

    Parameters

    customType

    The user-defined type of the event.

    location

    The location of the event.

    metadata

    The metadata associated with the event.

    completionHandler

    A completion handler.

Trips

Device Context

Search

Geocoding

Distances

Logging

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

Utilities

  • 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 *)stringForLocationSource:(RadarLocationSource)source;

    Swift

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

    Parameters

    source

    A location source value.

    Return Value

    A display string for the location source value.

  • Returns a display string for a travel mode value.

    Declaration

    Objective-C

    + (nonnull NSString *)stringForMode:(RadarRouteMode)mode;

    Swift

    class func stringForMode(_ mode: RadarRouteMode) -> String

    Parameters

    mode

    A travel mode value.

    Return Value

    A display string for the travel mode value.

  • Returns a display string for a trip status value.

    Declaration

    Objective-C

    + (nonnull NSString *)stringForTripStatus:(RadarTripStatus)status;

    Swift

    class func stringForTripStatus(_ status: RadarTripStatus) -> String

    Parameters

    status

    A trip status value.

    Return Value

    A display string for the trip status value.

  • Returns a dictionary for a location.

    Declaration

    Objective-C

    + (nonnull NSDictionary *)dictionaryForLocation:(nonnull CLLocation *)location;

    Swift

    class func dictionaryForLocation(_ location: CLLocation) -> [AnyHashable : Any]

    Parameters

    location

    A location.

    Return Value

    A dictionary for the location.