2017-04-26 12 views
0

Da ich mein Projekt auf Swift 3 "aktualisiert" habe, bekomme ich eine Ausnahme, wenn ich versuche, die ALAssetLibrary zu verwenden. Ich benutze diese anstelle der Fotos-Bibliothek, weil ich umfangreiche Metadaten in die Fotodatei schreiben möchte und bisher noch keine Möglichkeit gefunden habe, dies mit der Fotos-Bibliothek zu tun.ALAssetsLibraryGroupsEnumerationResultsBlock in Swift 3

Der folgende Code nicht jetzt:

let usingBlock = { 
    (group: ALAssetsGroup?, stop: UnsafeMutablePointer<ObjCBool>) in 
    // Code to execute 
} as! ALAssetsLibraryGroupsEnumerationResultsBlock 

Es scheint, dass die Besetzung nicht. Ich brauche ein Objekt vom Typ ALAssetsLibraryGroupsEnumerationResultsBlock, um ALAssetsLibrary.enumerateGroupsWithTypes zu rufen.

Wieder weiß ich, das ist veraltet, aber es sollte immer noch irgendwie funktionieren, nicht wahr?

Antwort

0

Die Signatur von ALAssetsLibraryGroupsEnumerationResultsBlock hat geändert typealias ALAssetsLibraryGroupsEnumerationResultsBlock = (ALAssetsGroup?, UnsafeMutablePointer<ObjCBool>?) -> Void

Sie müssen den Stopp Argument optional und dann sollte es funktionieren (siehe machen apple docs