부울 집합으로 ALAssetsLibrary enumerateAssets 메서드에 대한 열거 형을 어떻게 중단합니까? 루프에서 빠져 나갈 수 있을까요?사진 반복 반복 ALAssetsLibrary
CODE :
[self.library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
@try {
if(group != nil) {
@autoreleasepool {
int newNumberOfPhotos = [group numberOfAssets];
if (self.numberOfPhotosInSavedPhotos < newNumberOfPhotos) {
//only new photos
NSRange range = NSMakeRange(self.numberOfPhotosInSavedPhotos, newNumberOfPhotos-self.numberOfPhotosInSavedPhotos);
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:range];
[group enumerateAssetsAtIndexes:indexSet options:0 usingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
@autoreleasepool {
if(someCondition) {
//get out of the enumeration block (that is, exit the method) or go to complete block
}
NSString *assetType = [result valueForProperty:ALAssetPropertyType];
}
} ];
}
}
} else {
//enumeration ended
}
}
@catch (NSException *e) {
NSLog(@"exception streaming: %@", [e description]);
}
}failureBlock:^(NSError *error){
NSLog(@"Error retrieving albums stream: %@", [error description]);
if (error.code==-3312 || error.code==-3311) {
}
}];
하시기 바랍니다. 더 구체적이고 어디서 붙어서 도움이 필요합니까? 관련 코드를 게시하면 문제를 이해하는 데 도움이됩니다. – swiftBoy