iOS 后台作业组件 Queue for iOS
- 授权协议: MIT
- 开发语言: Objective-C
- 操作系统: iOS
- 软件首页: https://github.com/thisandagain/queue
- 软件文档: https://github.com/thisandagain/queue
软件介绍
Queue 是一个支持持久化后台作业队列的 iOS 开发包。示例代码:
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[[EDQueue sharedInstance] setDelegate:self];
[[EDQueue sharedInstance] start];
}
- (void)applicationWillResignActive:(UIApplication *)application
{
[[EDQueue sharedInstance] stop];
}
- (EDQueueResult)queue:(EDQueue *)queue processJob:(NSDictionary *)job
{
sleep(1); // This won't block the main thread. Yay!
// Wrap your job processing in a try-catch. Always use protection!
@try {
if ([[job objectForKey:@"task"] isEqualToString:@"success"]) {
return EDQueueResultSuccess;
} else if ([[job objectForKey:@"task"] isEqualToString:@"fail"]) {
return EDQueueResultFail;
}
}
@catch (NSException *exception) {
return EDQueueResultCritical;
}
return EDQueueResultCritical;
}
