nsfetchedresultscontroller

NSFetchedResultsControllers in different view controllers updating each other?

为君一笑 提交于 2020-01-15 11:57:29
问题 Ok I get more and more general with this question, since I've noticed several lags in my app due to this. I've noticed the problem with reordering, but it happens in other places as well. I have a CoreDataViewController class which all my table view controllers subclass. And in this class I basically have all NSFetchedResultsController delegate methods as they are in the apple docs. Then I've tried to find out how often changes are noticed by this NSFetchedResultsController to find out where

How to update user interface on Core Data?

假如想象 提交于 2020-01-14 06:03:40
问题 I have an app with UITableView, Core Data and NSFetchedResultsController as well. I have passed data to the DetailViewController. And I can delete them from the DetailViewController! In the Apple's iOS Notes app, you can see such as functions as I wanted! When you delete a notes from the DetailViewController ( for example ), object deleted and Notes app automaticlly shows the next or previos notes! I want to create such as function. How update user interface after deleted current object? Here

Deriving UITableView sections from NSFetchedResultsController using “to many” relationship

允我心安 提交于 2020-01-13 02:14:30
问题 My Core Data model looks like this: article <--->> category Is it even remotely possible to use NSFetchedResultsController to produce a UITableView that looks something like this? Category 1 - Article A - Article B - Article C Category 2 - Article A - Article D - Article E - Article F Category 3 - Article B - Article C Specifically, I'm interested in the (edge?) case where each UITableView section has a unique title (eg, "Category 1", "Category 2"), but the same object can exist in multiple

How can I solve NSInternalInconsistencyException', reason: '+entityForName: fail report

谁都会走 提交于 2020-01-11 09:43:31
问题 My code looks like that: NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity]; NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context]; // If appropriate, configure the new managed object. [newManagedObject setValue:[NSDate date] forKey:@"date"]; // Save the context. NSError *error = nil; if (!

How can I solve NSInternalInconsistencyException', reason: '+entityForName: fail report

荒凉一梦 提交于 2020-01-11 09:43:09
问题 My code looks like that: NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity]; NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context]; // If appropriate, configure the new managed object. [newManagedObject setValue:[NSDate date] forKey:@"date"]; // Save the context. NSError *error = nil; if (!

NSFetchedResultsController inserts the same cell into two sections only when controller is about to insert another section

点点圈 提交于 2020-01-10 03:16:08
问题 This is my Message.swift file: @objc(Message) class Message: NSManagedObject { @NSManaged var content: String @NSManaged var createdAt: NSDate @NSManaged var identifier: Int64 @NSManaged var conversation: Conversation @NSManaged var sender: Contributor var normalizedCreatedAt: NSDate { return createdAt.dateWithDayMonthAndYearComponents()! } } This is how I setup my FRC: private func setupFetchedResultsController() { let context = NSManagedObjectContext.MR_defaultContext() let fetchRequest =

Order of sections produced by NSFetchedResultsController?

≯℡__Kan透↙ 提交于 2020-01-07 07:16:24
问题 Does a NSFetchedResultsController assign values for the attribute identified by sectionNameKeyPath to sections always in ascending order? For instance if my sectionNameKeyPath were an (optional) boolean attribute with values @(YES) , @(NO) , @(YES) , would the first section receive one row (because NO corresponds to 0 ) and the second section receive two (because YES corresponds to 1 )? So is that the case and if that is, can one change the order (without introducing another attribute that

fetchresultscontroller issue or managed object context?

假装没事ソ 提交于 2020-01-06 19:56:33
问题 Reference POST: Core Data - Basic Questions I am able to get the Managed object context from this piece of code. It bring me to another question. I have 2 VIEW CONTROLLERS and 1 NSObject Userlookup (VC) UserlookupSettings(VC) FetchProcessor (NSObject) In sequence, Userlookup vc loads first and has a button to load the Userlookupsettings VC + a textbox and UiButton. When the app is loaded and I hit the SETTINGS uibutton, things work fine... however, when i do the search (FetchProcessor) and

Should I Use a FetchedResultsController for Objects in a Constantly Updating Relationship?

*爱你&永不变心* 提交于 2020-01-06 07:17:08
问题 I have a simple Coredata model with one entity called "conversation" and the other one "messages". Basically, I need to kind of reproduce the iPhone sms application. I have a to-one relationship from message to conversation and a to-many from conversation to messages. Conversation{ messages<-->>Message.conversation } Message{ conversation<<-->Conversation.messages } Anytime I launch my app, all my conversation are loaded in my fetchedResultsController. If I understood correctly how Coredata

Core Data: sorting by count in a to-many relationship

倖福魔咒の 提交于 2020-01-03 07:19:14
问题 I am currently trying to setup a NSFetchedResultsController that will order my table view based on the number of entities in a to-many relationship. I am not sure if this makes a difference when counting, but this is also an inverse relationship. I thought something like this would work just fine: NSEntityDescription *entity = [NSEntityDescription entityForName:@"Parent" inManagedObjectContext:managedObjectContext]; NSSortDescriptor *sortDescriptor1 = [[NSSortDescriptor alloc] initWithKey:@