SPEidUpdater
Objective-C
@interface SPEidUpdater : NSObject
Swift
class SPEidUpdater : NSObject
SPEidUpdater
This class is used to download EID data from a remote server as well as determining the status of local EID data.
-
Declaration
Objective-C
+ (nonnull instancetype)sharedInstance;
Swift
class func sharedInstance() -> Self
Return Value
Singleton instance of SPEidUpdater
-
Unavailable
call sharedInstance instead
unavailable methods, do not use these
Declaration
Objective-C
- (nonnull instancetype)init;
-
Starts downloading EID data for specific buildings.
If you plan on using this function when reacting to remote notifications in background mode, you need to supply the completion handler that will be called internally by SPEidUpdater to stop downloads.
Declaration
Objective-C
- (void)download:(nonnull NSArray<NSString *> *)buildings to:(nonnull NSDate *)date completion:(nullable void (^)(UIBackgroundFetchResult))completionHandler;
Swift
func download(_ buildings: [String], to date: Date, completion completionHandler: ((UIBackgroundFetchResult) -> Void)? = nil)
Parameters
buildings
list of building identifiers
date
the date where downloaded data should be valid
completionHandler
will be called when download is complete
-
Checks local device cache for EID data related to specific buildings.
You can use this to check if the device has valid EID data for a specific date.
Declaration
Objective-C
- (void)hasDataFor:(nonnull NSArray<NSString *> *)buildings date:(nonnull NSDate *)date completion: (nullable void (^)(NSArray<NSString *> *_Nonnull))completionBlock;
Swift
func hasData(for buildings: [String], date: Date, completion completionBlock: (([String]) -> Void)? = nil)
Parameters
buildings
list of building identifiers
date
the date when EID data should be valid
completionBlock
will be called after local data has been read. Returns buildings that have valid EID data.