nsfetchedresultscontroller

UITableView unexpectedly bounces with beginUpdates()/endUpdates()/performBatchUpdates()

旧街凉风 提交于 2019-12-01 06:49:08
I have a pretty straight forward UITableViewController / NSFetchedResultsController case here. It's from Xcode Master-Detail App sample code, So easy to reproduce. I have a CoreData Model with 1 Entity with 1 String Attribute. It's displayed in a UITableViewController . I use .subtitle system cell type. By selecting a row, I simply update the String Attribute. So my problem is, when I add just enough rows for the tableview to scroll (10-11 rows on a iPhone 5s with navbar), and I scroll down, and select any row, the tableview bounces up and down. If there is less rows (less than 10 rows), or

NSSortDescriptor issue

霸气de小男生 提交于 2019-12-01 06:42:23
I am making a contact book App where I am fetching names from AddressBook and stored them in Core data and displayed the names on a table using NSFetchedResultsController.However the first index and section that comes up is # followed by the alphabets. But I want to do it like it is in native contact app i.e. # index should come at last. I used the following NSortDescriptor : sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"fullName" ascending:YES ]; here "fullName" is the key in core data which is made by concatenating first name and last name. And the section identifier is the first

NSSortDescriptor with arbitrary sorting

ぐ巨炮叔叔 提交于 2019-12-01 06:36:43
I can't wrap my head around how to do arbitrary sorting with a NSSortDescriptor. I want to do something like this: NSArray *sortAlgorithm = [NSArray arrayWithObjects:@"@", @"#", @"!", @"&", @"r", @"a", nil]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES comparator: ^(id obj1, id obj2) { NSComparisonResult comparisonResult; //Some code that uses sortAlgorithm. return comparisonResult; } ]; This would sort the objects by the key name so that any key that starts with @ , e.g. @home , would come before any key that starts with r , e.g. radical , and

Does NSFetchedResultsController Observe All Changes to Persistent Store?

自作多情 提交于 2019-12-01 04:12:17
My program does work like link below: Update results of NSFetchedResultsController without a new fetch show result of NSFetchedResultsController to UITableView get new object from web service and store it to core data (in same view controller, with RestKit) update table view with notification of NSFetchedResultsController delegate The implementation of NSFetchedResultsControllerDelegate is copied from Apple's Core Data project and my predicated is: [NSPredicate predicateWithFormat:@"isMyTest == TRUE"] If the property update goes from TRUE to FALSE, it removes rows from the tableview (because

NSPredicate, get results with a subset of one-to-many relationship

孤街浪徒 提交于 2019-12-01 00:35:21
I'mm working around with Core Data and NSFetchedResultsController . My Data Model looks like this: Product with one-to-many relationship called dataLines . The dataLine entity has a property name theWeek . I want to fetch all Product where dataLines.theWeek == someValue . This is easily done with a subquery. But this returns all dataLines. Is it possible to create a NSPredicate that returns the Product and a subset if dataLines only with the dataLines == someValue ? What you want to achieve could be reached in two ways: using a SUBQUERY [NSPredicate predicateWithFormat:@"SUBQUERY(dataLines, $x

NSPredicate and CoreData - decide if a Date attribute is “today” (or between last night 12am to tonight 12am) on iOS

只愿长相守 提交于 2019-11-30 19:12:28
I'm using a NSFetchedResultsController and a UITableViewController to populate a UITableView from a CoreData database. I have a NSDate object saved into this Date attribute labeled "startTime". Then I'm trying to only pull todays's data by using a NSPredicate that looks like this: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"startDate == %@", todaysDate]; I'm getting zero results. I understand this because a NSDate object just hold the number of seconds or milliseconds or whatever since Jan 1 1970 right? So comparing 1111111111111 and 1111111111112, while on the same day, are

Assertion failure when i use the Add Function

守給你的承諾、 提交于 2019-11-30 16:39:53
In a table, I have 3 indexes which calls each a function. In each function, there is an add button that adds data into CoreData. First 2 works, but when i press the 3rd index and press Add , this error appears. 2011-07-19 16:57:11.079 CoreDataMelaka[2704:207] * **Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UITableView.m:976** 2011-07-19 16:57:11.080 CoreDataMelaka[2704:207] **Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of

Core Data app crashing with “controllerWillChangeContent : unrecognized selector sent to instance”

不想你离开。 提交于 2019-11-30 13:57:11
I've got a core data app with 2 views. The first view lists "Rooms", the second lists "Scenes" in rooms. The Rooms page has an edit NavItem button, which when pressed enables an add NavItem button. You can delete and add rooms from here. Added rooms simply appear with a default "New Room" name in the table. The second view is a list of Scenes in the selected room. Same deal here, you can delete and add Scenes, and added Scenes simply appear in the table with the name "New Scene". Nothing special really. I'm using a FetchedResultsController in both view controllers, with the Scenes one having

UITableView with NSFetchedResultsController Does Not Load the Second Time

核能气质少年 提交于 2019-11-30 13:51:50
Update 3 These are the logs after the first run with an empty data store. 2013-02-07 20:57:06.708 Five Hundred Things[14763:c07] mainMOC = <NSManagedObjectContext: 0x7475a90> 2013-02-07 20:57:06.711 Five Hundred Things[14763:1303] Import started 2013-02-07 20:57:06.712 Five Hundred Things[14763:1303] backgroundMOC = <NSManagedObjectContext: 0x8570070> 2013-02-07 20:57:06.717 Five Hundred Things[14763:c07] FRC fetch performed 2013-02-07 20:57:06.718 Five Hundred Things[14763:c07] numberOfSectionsInTableView returns 1 2013-02-07 20:57:06.720 Five Hundred Things[14763:c07]

How to refresh a UITableViewController or NSFetchedResultsController?

末鹿安然 提交于 2019-11-30 13:19:03
I have a little problem with my UITableViewController or NSFetchedResultsController. I am not sure which is the problem soure but I guess its the UITableViewController. As I said I use a NSFetchedResultsController to fill my data into a UITableViewController. The data is sorted by date and is also displayed in sections by date-year, e.g. May 2010/June 2010/ and so on. This is displayed as the section header. Now when I add new data, it automatically uses the current date as default, but if I want to use a date, that is currently not in the section list, e.g. April 2010 (currently May and June