From 0fa2a23461ebd1f3aff25072f058fe2d52b9b352 Mon Sep 17 00:00:00 2001 From: John Estropia Date: Fri, 9 Sep 2016 13:09:13 +0900 Subject: [PATCH] workaround for iOS 10 regression in "affectedStores" retain bug --- Sources/Internal/CoreStoreFetchRequest.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Sources/Internal/CoreStoreFetchRequest.swift b/Sources/Internal/CoreStoreFetchRequest.swift index 5178351..1c8bc4c 100644 --- a/Sources/Internal/CoreStoreFetchRequest.swift +++ b/Sources/Internal/CoreStoreFetchRequest.swift @@ -49,14 +49,13 @@ internal final class CoreStoreFetchRequest: NSFetchRequ get { - return super.affectedStores -// let affectedStores: NSArray? = super.affectedStores.flatMap({ NSArray(array: $0) } ) -// return affectedStores as? [NSPersistentStore] + // This forced-casting is needed to fix an ARC bug with "affectedStores" mis-retaining the array + let affectedStores: NSArray? = super.affectedStores.flatMap({ NSArray(array: $0) } ) + return affectedStores as? [NSPersistentStore] } set { super.affectedStores = newValue -// super.affectedStores = newValue.flatMap(Array.init) } } }