I try to use the enumerateGroupsWithTypes
method of the ALAssetsLibrary
class but I get an error with the first parameter.
func enumerateGroupsWithTypes(types: ALAssetsGroupType,
usingBlock enumerationBlock: ALAssetsLibraryGroupsEnumerationResultsBlock!,
failureBlock: ALAssetsLibraryAccessFailureBlock!)
assetLib.enumerateGroupsWithTypes(ALAssetsGroupAll, usingBlock: success, failureBlock: fail)
but I get a compile error 'CUnsignedInt' is not convertible to 'ALAssetsGroupType'
Based on what I've found on internet and my own tests, I've also tried
assetLib.enumerateGroupsWithTypes(ALAssetsGroupAll as ALAssetsGroupType, usingBlock: success, failureBlock: fail)
And the result is a compile error Cannot convert the expression's type 'Void' to type 'ALAssetsGroupType'
assetLib.enumerateGroupsWithTypes(ALAssetsGroupType(ALAssetsGroupAll), usingBlock: success, failureBlock: fail)
And the result is a runtime error EXC_BAD_ACCESS
and an XCode crash.
Looks like the correct way is to use ALAssetsGroupType
's initializer to create a new ALAssetsGroupType
. The following should work:
assetLib.enumerateGroupsWithTypes(ALAssetsGroupType(ALAssetsGroupAll), usingBlock: success, failureBlock: fail)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With