iOS 后台作业持久存储:Queue for iOS

jopen 12年前

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;  }

项目主页:http://www.open-open.com/lib/view/home/1363141911750