线程

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
062. ALAssetsLibraryGroupsEnumerationResultsBlock listGroupBlock = ^(ALAssetsGroup *group, BOOL *stop) {
063. if (group != nil) {
064. [weakSelf.groupArrays addObject:group];
065. else {
066. [weakSelf.groupArrays enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
067. [obj enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
068. if ([result thumbnail] != nil) {
069. // 照片
070. if ([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto]){
071.  
072. NSDate *date= [result valueForProperty:ALAssetPropertyDate];
073. UIImage *image = [UIImage imageWithCGImage:[result thumbnail]];
074. NSString *fileName = [[result defaultRepresentation] filename];
075. NSURL *url = [[result defaultRepresentation] url];
076. int64_t fileSize = [[result defaultRepresentation] size];
077.  
078. NSLog(@"date = %@",date);
079. NSLog(@"fileName = %@",fileName);
080. NSLog(@"url = %@",url);
081. NSLog(@"fileSize = %lld",fileSize);
082.  
083. // UI的更新记得放在主线程,要不然等子线程排队过来都不知道什么年代了,会很慢的
084. dispatch_async(dispatch_get_main_queue(), ^{
085. self.litimgView.image = image;
086. });
087. }

你可能感兴趣的:(线程)