I'm trying to get an image which is on the photo library, and I'm using assetForURL for that purpose, but I get all the time the error "Cannot invoke 'assetForURL' with an argument list of type '(NSURL, resultBlock: (ALAsset!) -> Void, (NSError!) -> Void)'"
I've checked questions here and how other people use that method, but I get always the same error.. Here is my method:
class func getImageFromPath(path: String) -> UIImage? {
let assetsLibrary = ALAssetsLibrary()
let url = NSURL(string: path)!
assetsLibrary.assetForURL(url, resultBlock: { (asset: ALAsset!) -> Void in
return UIImage(CGImage: asset.defaultRepresentation().fullResolutionImage())
}) { (error: NSError!) -> Void in
return nil
}
}
I don't know what I'm missing.. thx!