Inherits from NSObject
Declared in SGSCountdownManager.h

Overview

@class SGSCountdownManager

Class Methods

sharedManager

单例

+ (instancetype)sharedManager

Declared In

SGSCountdownManager.h

Instance Methods

CountdownTaskExistsByKey:

判断倒计时任务是否存在

- (BOOL)CountdownTaskExistsByKey:(NSString *)key

Parameters

key

倒计时任务标识符

Return Value

YES(存在),NO(不存在)

Declared In

SGSCountdownManager.h

finishCountdownTaskAndInvalidateWithKey:

强制结束倒计时

- (void)finishCountdownTaskAndInvalidateWithKey:(NSString *)key

Parameters

key

倒计时任务标识符

Declared In

SGSCountdownManager.h

scheduledCountdownWithKey:timeInterval:runInBackground:countingHandler:finishedHandler:

- (BOOL)scheduledCountdownWithKey:(NSString *)key timeInterval:(NSTimeInterval)timeInterval runInBackground:(BOOL)runInBackground countingHandler:(nullable void ( ^ ) ( NSTimeInterval timeInterval ))countingHandler finishedHandler:(nullable void ( ^ ) ( __unused NSTimeInterval timeInterval ))finishedHandler
Discussion

如果需要在后台运行,由于操作系统后台限制, 倒计时时间规定不得大于120秒,除非是音乐播放器或运动类APP

Parameters

key

倒计时任务标识符

timeInterval

倒计时总时间

runInBackground

是否在后台运行

countingHandler

进行倒计时的Block

finishedHandler

倒计时结束时的Block

Return Value

YES(成功执行),NO(执行不成功)

Declared In

SGSCountdownManager.h

taskIsCountingByKey:

判断倒计时任务是否正在进行

- (BOOL)taskIsCountingByKey:(NSString *)key

Parameters

key

倒计时任务标识符

Return Value

YES(正在进行),NO(没有进行或不存在该倒计时任务)

Declared In

SGSCountdownManager.h