Radar

@interface Radar : NSObject

The top-level class used to interact with the Radar SDK. For more information, see https://radar.io/documentation/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 when logged in.

    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.

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

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

  • Sets the provider for Places data.

    Declaration

    Objective-C

    + (void)setPlacesProvider:(RadarPlacesProvider)provider;

    Swift

    class func setPlacesProvider(_ provider: RadarPlacesProvider)

    Parameters

    provider

    The provider for Places data.

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

    Warning

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

    Declaration

    Objective-C

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

    Swift

    class func trackOnce(completionHandler: RadarCompletionHandler? = nil)

    Parameters

    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 must be kCLAuthorizationStatusAuthorizedAlways.

    Declaration

    Objective-C

    + (void)startTrackingWithOptions:(RadarTrackingOptions *)trackingOptions;

    Swift

    class func startTracking(trackingOptions: RadarTrackingOptions!)
  • 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. *

  • Manually updates the user’s location.

    Warning

    Be careful not to exceed the rate limit of 1 request per second per user or 60 requests per hour per user.

    Declaration

    Objective-C

    + (void)updateLocation:(CLLocation *_Nonnull)location
        withCompletionHandler:(RadarCompletionHandler _Nullable)completionHandler;

    Swift

    class func updateLocation(_ location: CLLocation, completionHandler: RadarCompletionHandler? = nil)

    Parameters

    location

    A location for the user.

    completionHandler

    An optional completion handler.

  • Sets an optional delegate for client-side delivery of server-persisted events and location updates.

    Declaration

    Objective-C

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

    Parameters

    delegate

    A delegate for client-side delivery of server-persisted events and location updates. 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
        withVerifiedPlaceId:(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.

  • Undocumented

    Declaration

    Objective-C

    + (void)performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler NS_SWIFT_NAME(performFetchWithCompletionHandler(_:));

    Swift

    class func performFetchWithCompletionHandler(_ completionHandler: ((UIBackgroundFetchResult) -> Void)!)