【发布时间】:2014-04-25 04:59:14
【问题描述】:
[aLib enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:assetsGroupEnumerationBlock failureBlock:failureBLock];
这个方法枚举每个组,我想枚举第一组,然后我想打破它。我的目的是请求允许 iOS 首次弹出。我没有做任何额外的工作,我在块中有通知,通知和触发其他必需的功能。但是多组枚举多次触发通知,我想停止。
这是我的带有停止参数的枚举块
void(^assetsGroupEnumerationBlock)(ALAssetsGroup*, BOOL*) = ^(ALAssetsGroup *groups, BOOL *stop) {
*stop = YES;
NSDictionary *alAuthDict = @{@"alAssetsAuthStatusDictKey" : [NSString stringWithFormat:@"%ld",[self getALAssetAuthorizationStatus]]};
[[NSNotificationCenter defaultCenter]postNotificationName:@"alAssetsStatusNotificationName" object:nil userInfo:alAuthDict];
};
但是通知被调用了两次,我在控制台中看到了两次nslog。
【问题讨论】:
标签: ios objective-c alassetslibrary alassetsgroup