UALocation
Objective-C
@interface UALocation : NSObject <UAComponent, UALocationProvider>
Swift
class UALocation : NSObject, Component, UALocationProvider
Main class for interacting with Airship location. Used to send location updates for the user to Airship.
-
The shared location instance.
Declaration
Objective-C
@property (class, nonatomic, readonly) UALocation *_Nonnull shared;
Swift
class var shared: UALocation { get }
-
Flag to enable/disable requesting location authorization when the location service needs to start. Defaults to
YES
.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isAutoRequestAuthorizationEnabled) BOOL autoRequestAuthorizationEnabled;
Swift
var isAutoRequestAuthorizationEnabled: Bool { get set }
-
Flag to enable/disable location updates. Defaults to
NO
.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isLocationUpdatesEnabled) BOOL locationUpdatesEnabled;
Swift
var isLocationUpdatesEnabled: Bool { get set }
-
Flag to allow/disallow location updates in the background. Defaults to
NO
.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isBackgroundLocationUpdatesAllowed) BOOL backgroundLocationUpdatesAllowed;
Swift
var isBackgroundLocationUpdatesAllowed: Bool { get set }
-
UALocationDelegate to receive location callbacks.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<UALocationDelegate> delegate;
Swift
weak var delegate: LocationDelegate? { get set }
-
Returns the last received location. Can be nil if no location has been received.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) CLLocation *lastLocation;
Swift
var lastLocation: CLLocation? { get }
-
Check if the user has opted in to location updates.
Declaration
Objective-C
- (BOOL)isLocationOptedIn;
Swift
func isLocationOptedIn() -> Bool
Return Value
YES
if UALocation location updates are enabled, the user has authorized the app to use location services, and data collection is enabled. -
Check if the user has denied the app’s request to use location services.
Declaration
Objective-C
- (BOOL)isLocationDeniedOrRestricted;
Swift
func isLocationDeniedOrRestricted() -> Bool
Return Value
YES
if Uthe user has denied the app’s request to use location services. -
Check if the user has granted this application access to location information with reduced accuracy.
Warning
The values this method returns should only be taken into account if the user has opted in to location updates.Declaration
Objective-C
- (BOOL)isLocationAccuracyReduced;
Swift
func isLocationAccuracyReduced() -> Bool
Return Value
NO
if the user granted this application access to location information with full accuracy.