【发布时间】:2013-03-07 17:00:25
【问题描述】:
了解如何通过以下链接从 iOS 设备中检索最后一张照片
How to retrieve the most recent photo from Camera Roll on iOS?
但我想检索最后 20 张左右的照片,因为我不想降低性能,也不想让用户以相反的顺序查看他们的照片
我试过了
long index = group.numberOfAssets - 2;
并以这个错误结束
由于未捕获的异常 'NSRangeException' 导致应用程序终止,原因:'*** -[NSIndexSet initWithIndexesInRange:]: Range {4294967294, 1} 超过 NSNotFound 的最大索引值 - 1'
有人可以帮忙吗?谢谢
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
[group setAssetsFilter:[ALAssetsFilter allPhotos]];
***long index = group.numberOfAssets - 2;***
[group enumerateAssetsAtIndexes:[NSIndexSet indexSetWithIndex:index]
options:0
usingBlock:^(ALAsset *alAsset, NSUInteger index, BOOL *innerStop)
【问题讨论】:
标签: ios objective-c