nsfetchedresultscontroller

Use UICollectionView and NSFetchedResultsController doesn't save

不想你离开。 提交于 2019-12-13 18:53:24
问题 I'm using a project find on github that lets me use NSFetchedResultsController and UICollectionView , the project is this in my project i have a Core Data with two Entity, Element and Document , there is a relationship one to many between Element and Document , so an Element can have more Document , but a Document can have only one Element , then i do this in the AppDelegate : - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self

Repopulating UITableView after search

本小妞迷上赌 提交于 2019-12-13 06:05:18
问题 I'm using single NSFetchedResultController to populate both self.tableView and UISearchDisplayControler.tableView . After using search bar and dismissing it if I select any row in the self.tableView I get this error: Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' I guess that somewhere I miss reloading data but I have no clue where? Here are some methods which I use for populating both tabble

What's the best way to show recurring events in uitableview

Deadly 提交于 2019-12-13 05:54:15
问题 I'm developing a Calendar app on iOS and showing all events in a UITableview with NSFetchedResultsController. Due to some reasons, I can't use EKEvent as event model, so I decide to implement a new Event model. When perform recurring events, there are two ways: For each recurring event, generate all sub-events according to recurring rules, and insert them to core data. Positive: I can use NSFetchedResultsController to show all events in UITableview normally. Negative: For any updates to a

Fetch from Core Data sorted by formatted date

雨燕双飞 提交于 2019-12-13 04:55:48
问题 I am having trouble fetching results from Core Data that are sorted by date. I have a DB table that contains football matches. Each match has a homeTeam, awayTeam and kickoffTime. The kickoffTime is an NSDate that stores the date and time the match will start. I want to display the results of a query in a TableView divided into sections by the kickoff date. With the date as the section heading. This is a little more complex than it might first appear. Due to differing time zones a match

UITableView endUpdates not being called in dispatch_async

一世执手 提交于 2019-12-13 04:38:32
问题 I have several table views that send JSON requests to a server, store the results in core data, and display them using an NSFetchedResultsController . I was experimenting with GCD as follows: dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ // Perform JSON requests. dispatch_async(dispatch_get_main_queue(), ^{ [theTableView reloadData]; }); }); However, this would cause some weird things to happen in the UI. New managed objects would render blank cells, deleted

iOS: How to use predicates NSexpression to check user input for validity and conformance

ⅰ亾dé卋堺 提交于 2019-12-13 04:31:13
问题 In my app using coredata i have an entity with two attributes GridValue (numerical value), RecordingDate (NSdate)). The user in one tableview can enter these two values each day and they are recorded with a fetch controller. For more understanding here is a screenshot of the two views concerned with the issue: Th Addviewcontroller is where the user adds a new value and when user clicks on any of the two fields in the static tableview, he is redirected to the "Zahl Datum" view for editing.

NSFetchedResultsController remove row from UITableView after update relationships

拥有回忆 提交于 2019-12-13 01:43:57
问题 This is how I setup NEFetchedResultsController : private func setupOnceFetchedResultsController() { if fetchedResultsController == nil { let context = NSManagedObjectContext.MR_defaultContext() let fetchReguest = NSFetchRequest(entityName: "WLWishlist") let dateDescriptor = NSSortDescriptor(key: "createdAt", ascending: false) fetchReguest.predicate = NSPredicate(format: "ANY users.identifier = %@", String(WLAppSettings.currentUser!.identifier) ) fetchReguest.sortDescriptors = [dateDescriptor]

NSFetchedResultsController with data not updating

纵饮孤独 提交于 2019-12-13 00:32:55
问题 I'm making an app which fetches a list of products from a server. I then store them in a Core Data database and I present them using GMGridView and the datasource is a NSFetchedResultsController. When I change the product details in the server, I want my iOS app to synchronize and make the necessary changes so I implement the NSFetchedResultsControllerDelegate method. How should I update my gridView properly? - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id

lazy var NSFetchedResultsController producing error in Swift 3.0

这一生的挚爱 提交于 2019-12-12 13:50:23
问题 I just migrated my project to Swift 3 and am stuck on an error for my lazy instantiated NSFetchResultController. I use this method here : https://www.andrewcbancroft.com/2015/03/05/displaying-data-with-nsfetchedresultscontroller-and-swift/ My current code lazy var fetchedResultsController: NSFetchedResultsController = { let primarySortDescriptor = NSSortDescriptor(key: "company", ascending: true) let sortDescriptors = [primarySortDescriptor] self.fetchRequest.sortDescriptors = sortDescriptors

NSFetchedResultsController not working with transient properties

你说的曾经没有我的故事 提交于 2019-12-12 12:50:59
问题 Working fine in Swift 3 with Xcode8.3 I have an project ongoing which has core data for saving messages. It sorts messages according to time and sections them according to day. Here's how: let request = NSFetchRequest(entityName: "Message") let sortDiscriptor = NSSortDescriptor(key: "time", ascending: true) request.sortDescriptors = [sortDiscriptor] fetchedResultsController = NSFetchedResultsController(fetchRequest: request, managedObjectContext: mainThreadMOC, sectionNameKeyPath: