             return
         }
         
+        var willProcessTransaction: () -> () = { }
+        var didProcessTransaction: () -> () = { }
+        #if os(iOS)
+            if let application = application {
+                var backgroundTaskID: UIBackgroundTaskIdentifier! = nil
+                willProcessTransaction = {
+                    backgroundTaskID = application.beginBackgroundTask {
+                        application.endBackgroundTask(backgroundTaskID)
+                    }
+                }
+                didProcessTransaction = {
+                    application.endBackgroundTask(backgroundTaskID)
+                }
+            }
+        #endif
+        
         let initialItems = fetchedItems
         databaseWriter.write { db in
-            let fetchAndNotifyChanges = makeFetchAndNotifyChangesFunction(controller: self, fetchAlongside: fetchAlongside, itemsAreIdentical: itemsAreIdentical, willChange: willChange, onChange: onChange, didChange: didChange)
+            let fetchAndNotifyChanges = makeFetchAndNotifyChangesFunction(
+                controller: self,
+                fetchAlongside: fetchAlongside,
+                itemsAreIdentical: itemsAreIdentical,
+                willProcessTransaction: willProcessTransaction,
+                willChange: willChange,
+                onChange: onChange,
+                didChange: didChange,
+                didProcessTransaction: didProcessTransaction)
             let observer = FetchedRecordsObserver(selectionInfo: request.selectionInfo, fetchAndNotifyChanges: fetchAndNotifyChanges)
             self.observer = observer
             if let initialItems = initialItems {

    //
    // Should controller become strong at any point before callbacks are
    // called, such unowned reference would have an opportunity to crash.
    return makeFetchFunction(controller: controller, fetchAlongside: fetchAlongside) { [weak controller] result in
        // Return if fetched records controller has been deallocated
        guard let callbackQueue = controller?.queue else { return }
        

                    }
                }
                didChange?(strongController, fetchedAlongside)
                didProcessTransaction()
            }
        }
    }
