Since I "upgraded" my project to Swift 3, I get an exception when trying to use the ALAssetLibrary. I use this instead of Photos library because I want to write extensive metadata to the photo file and I have not found a way to do this with the Photos library so far.
The following code now fails:
let usingBlock = {
(group: ALAssetsGroup?, stop: UnsafeMutablePointer<ObjCBool>) in
// Code to execute
} as! ALAssetsLibraryGroupsEnumerationResultsBlock
It seems that the cast fails. I need an object of type ALAssetsLibraryGroupsEnumerationResultsBlock in order to call ALAssetsLibrary.enumerateGroupsWithTypes.
Again I know this is deprecated, but it should still work somehow shouldn't it?
The signature of ALAssetsLibraryGroupsEnumerationResultsBlock has changed to
typealias ALAssetsLibraryGroupsEnumerationResultsBlock = (ALAssetsGroup?, UnsafeMutablePointer<ObjCBool>?) -> VoidYou need to make the stop argument an optional and then it should work (see apple docs