From 6e738edc07766e6c44a328831c72b32ef1adae33 Mon Sep 17 00:00:00 2001 From: Ricardo Pereira Date: Thu, 24 Jan 2019 16:46:45 +0000 Subject: [PATCH] =?UTF-8?q?[fix]=20"[NSURL=20length]:=20unrecognized=20sel?= =?UTF-8?q?ector=20sent=20to=20instance=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trying to remove a file using FileManager.removeItem:at. The URL is an assets-library and something internally is invoking `length` maybe assuming it’s a NSString/CFStringRef 🤨 --- Sodes/SodesFoundation/FileManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sodes/SodesFoundation/FileManager.swift b/Sodes/SodesFoundation/FileManager.swift index f7a6301..b9eecfa 100644 --- a/Sodes/SodesFoundation/FileManager.swift +++ b/Sodes/SodesFoundation/FileManager.swift @@ -47,7 +47,7 @@ public extension FileManager { public func removeDirectory(_ directory: URL) -> Bool { do { - try removeItem(at: directory) + try removeItem(atPath: directory.absoluteString) } catch { return false @@ -57,7 +57,7 @@ public extension FileManager { public func removeFile(at url: URL) -> Bool { do { - try removeItem(at: url) + try removeItem(atPath: url.absoluteString) } catch { return false