NSFetchedResultsController calls delegate when data is deleted but not when data is inserted
<p>I am developing a journaling app using Core Data and iCloud. A simplified view of the Core Data model looks as follows:</p>

<blockquote>
  <p>[Journal] &lt;-->> [Post] &lt;-->> [Content]  </p>
</blockquote>

<p>I use NSFetchedResultControllers to populate a UITableView with 'Content'-, and a UICollectionView with 'Journals' from the model.  </p>

<p>The table view works perfectly and the fetched results controller's delegate is called whenever content changes, is added or deleted. In the collection view controller however, the fetched results controller is not calling the delegate when new journals are added or the posts or content within them changes (i realise the last part might be expected since the journal object itself doesn't change). However the delegate is called when journals are deleted.</p>

<p>I want the delegate to be called whenever journals are inserted, and have wrestled with this issue for hours without luck or further insight.</p>

<p>The fetched results controller is initialized and configured as follows:</p>

<pre><code>// property declaration
lazy var fetchedResultsController: NSFetchedResultsController = self.initialFetchedResultsController()

// initialization
func initialFetchedResultsController() -&gt; NSFetchedResultsController {
    let request = NSFetchRequest(entityName: "Journal")
    let nameSort = NSSortDescriptor(key: "name", ascending: true)
    request.sortDescriptors = [nameSort]
    return return NSFetchedResultsController(fetchRequest: request, managedObjectContext: DataModel.sharedModel().managedObjectContext, sectionNameKeyPath: nil, cacheName: nil)
}

// configuration, called in viewDidLoad()
func configureFetchedResultsController() {
    fetchedResultsController.delegate = collectionViewFetchedResultsControllerDelegate
    do {
        try fetchedResultsController.performFetch()
        print("fetching")
    } catch {
        fatalError("Failed to initialize FetchedResultsController: \(error)")
    }
}
</code></pre>

<p>The collectionViewFetchedResultsControllerDelegate passed to the fetchedResultsController during configuration is a standard NSFetchedResultsControllerDelegate managing the collection view of this view controller.  </p>

<p>When data is deleted the following method is invoked in the shared data model, resulting in the fetchedResultsController calling its delegate (i simply assert this by adding some debugging print statements to all the delegate's methods).  </p>

<pre><code>func deleteJournal(journal: Journal) {

    // delete all posts attached to journal
    deletePostsForJournal(journal)

    // delete journal
    managedObjectContext.deleteObject(journal)
    saveManagedObjectContext()
}

func deletePostsForJournal(journal: Journal) {

    // delete all content attached to posts of journal
    deleteContentForJournal(journal)

    // delete all posts attached to journal
    performBatchDeleteForJournal(journal, deleteEntityName: "Post", predicateFormat: "journal == %@")
}

func deleteContentForJournal(journal: Journal) {

    // delete all content attached to posts of journal
    performBatchDeleteForJournal(journal, deleteEntityName: "Content", predicateFormat: "post.journal == %@")

    // delete all images attached to posts of journal
    performBatchDeleteForJournal(journal, deleteEntityName: "Image", predicateFormat: "post.journal == %@")
}

private func performBatchDeleteForJournal(journal: Journal, deleteEntityName entityName: String, predicateFormat: String) {

    let fetchRequest = NSFetchRequest(entityName: entityName)
    fetchRequest.predicate = NSPredicate(format: predicateFormat, journal)
    let deleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest)

    do {
        try persistentStoreCoordinator.executeRequest(deleteRequest, withContext: managedObjectContext)
    } catch let error as NSError {
        print("Could not execute batch delete fetch request \(error), \(error.userInfo)")
    }

    saveManagedObjectContext()
}
</code></pre>

<p>However, when I update the model by inserting a new journal using the insert method below, the fetchedResultsController is not being called.  </p>

<pre><code>func createJournal(name: String) {

    // creates or returns (if already existing) a journal from the managed object context
    journalForName(name)
    saveManagedObjectContext()
}

func journalForName(name: String) -&gt; Journal {

    // configures fetch request
    let fetchRequest = NSFetchRequest()
    let entityDescription = NSEntityDescription.entityForName("Journal", inManagedObjectContext: managedObjectContext)
    fetchRequest.entity = entityDescription

    // configures predicate to match posts with date
    fetchRequest.predicate = NSPredicate(format: "name == %@", name)

    // executes fetch request
    do {
        let result = try self.managedObjectContext.executeFetchRequest(fetchRequest)

        if let journal = result.first as? Journal {
            return journal
        }

    } catch let error as NSError {
        print("Could not execute fetch request from managedObjectContext \(error), \(error.userInfo)")
    }

    // creates a new journal since one doesn't exist with this name
    let journal = Journal(entity: entityDescription!, insertIntoManagedObjectContext: managedObjectContext)
    journal.name = name
    return journal
}  
</code></pre>

<p>The journalForName method is implemented to only create a new Journal if one with the same name doesn't exist already.  </p>

<p>The insertion works and is updated in the model since the created Journal appears if you restart the application. I'd appreciate any help in solving this issue! Thanks.</p>