nsfetchedresultscontroller

NSFetchResultController with UICollectionView issue with indexes/cells on update and delete action

老子叫甜甜 提交于 2019-12-11 02:32:19
问题 First time that I'm using UICollectionView, and I'm having some difficulties. Especially with updating and deleting cells (will focus on delete here, hopefully the came cause), with data from a NSFetchResultController . I have made a custom cell in in interface builder as part of a storyboard like this: I have a custom UICollectionViewCell subclass with the following properties: @property (strong, nonatomic) IBOutlet UIButton *deleteButton; @property (strong, nonatomic) IBOutlet UITextField

NSPredicate acting strange in NSFetchedResultsController

本小妞迷上赌 提交于 2019-12-11 02:24:58
问题 I feel as if this should be very simple, but it's behaving strangely. I have 3 entities, with a relationship as such Entity A <-->> Entity B <<--> Entity C I have an NSFetchedResults controller and I'm trying to filter the results of Entity A using the following predicate. [NSPredicate predicateWithFormat:@"NONE entityB.entityC == %@", self.entityC]; When I try and run the app, the output shows no results. I can alter the predicate slightly to: [NSPredicate predicateWithFormat:@"ANY entityB

ResultsController to another ResultsController

女生的网名这么多〃 提交于 2019-12-11 02:15:23
问题 CoreData and ResultsController make the job really easy. But... Here is the situation: I have a functional resultsController in one tableView. When selecting a row, I go to another tableView that will show the child entity. With coreData, the child entity is ready to use. But how do I start another resultsController with this child entity? Do I need to fetchRequest again for this new resultsController using predicate to filter? Parent TablewView: Select row on resultsController -> Child

EXC_BAD_ACCESS with NSFetchedResultsController

巧了我就是萌 提交于 2019-12-11 02:14:56
问题 Trying to track down this error I get when I have NSZombieEnabled . I get an EXC_BAD_ACCESS when the fetched results controllers attempts to execute a fetch. Debugger says: -[CFNumber retain]: message sent to deallocated instance 0x6e88d10 Backtrace says: #0 0x014bbe1e in ___forwarding___ () #1 0x014bbce2 in __forwarding_prep_0___ () #2 0x0145c490 in CFRetain () #3 0x0147929a in CFNumberCreate () #4 0x00b221ed in -[NSPlaceholderNumber initWithShort:] () #5 0x00b2216a in +[NSNumber

NSFetchedResultsController with NSPredicate not updating

送分小仙女□ 提交于 2019-12-11 01:56:27
问题 I fetch data from a Core Data-base and present them in a UITableView . I use a NSFetchedResultController to fetch the data. I want the user to be able to search in the database, and to do that I use a NSPredicate . The data is presented in the UITableView and everything works well until I set the NSPredicate to the NSFetchedResultController . I use this in the ViewDidLoad method: self.fetchedResultsController = nil; fetchedResultsController_ = nil; NSError *error = nil; if (![[self

How can I refresh a NSFetchedResultsController?

牧云@^-^@ 提交于 2019-12-11 00:38:38
问题 I have a NSFetchedResultsController which displays data in a UITableView. I'm using the boiler plate code provided by Xcode when choosing to create a Core Data project. I added the following predicate to the NSFetchRequest the NSFetchedResultsController uses (before NSFetchedResultsController is initialized): NSPredicate *predicate = [NSPredicate predicateWithFormat:@"deleted == NO"]; [fetchRequest setPredicate:predicate]; Now in another location of my app, I set the deleted property like so

Using 2 FRCs with one TableView and configuring the FRCDelegate

≡放荡痞女 提交于 2019-12-10 22:33:27
问题 I found this post question link, and I have done my best to convert it from Obj-C to Swift. When I added a new Entity and try to save it to CoreData, the app crashes and highlights this line: modifiedIndexPath = NSIndexPath(row: (indexPath?.row)!, section: 0) The error in green behind it is as follows: Thread 1; EXC_BREAKPOINT (code=1, subcode=0x100008b118) . I have no idea what this means, and the output panel only shows (llbd) in green as well. EDIT - I figured out that the app is crashing

Extension of a generic Objective-C class cannot access the class's generic parameters at runtime

别说谁变了你拦得住时间么 提交于 2019-12-10 17:57:31
问题 I have the following NSFetchedResultsController extension: extension NSFetchedResultsController { func tryObjectAtIndex(_ indexPath: IndexPath) throws -> AnyObject // ERROR HERE { do { try ObjC.catchException { return self.object(at: indexPath) // CAUSE } } catch { print("An error ocurred: \(error)") } } } in which ObjC is an Objective-C class (from here). Here's the .h : #import <Foundation/Foundation.h> @interface ObjC : NSObject + (BOOL)catchException:(void(^)())tryBlock error:(_

Get NSFetchedResultsController section object from UICollectionView's viewForSupplementaryElementOfKind

核能气质少年 提交于 2019-12-10 17:18:19
问题 I have a data model called Location . I use these as my section headers in a UICollectionViewController . Each location can display items inside these sections. I want to customise my section headers in viewForSupplementaryElementOfKind . But I can't figure out how to recive the correct Location objects from this method. I have tried things like: -(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:

NSFetchedResultsController misses updates on merged NSManagedObjectContext

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 13:26:50
问题 I have two managed object contexts, A and B. These two contexts are kept in sync by merging changes from one to the other whenever they're saved (by monitoring NSManagedObjectContextDidSaveNotification ). I've verified that changes to A and B are merging properly. I have an NSFetchedResultsController monitoring updates to B. I find that certain updates to A do not result in the nsfrc firing on B. When a new managed object is created and added to A with the attributes the nsfrc is looking for