uimanageddocument

Core Data NSPredicate “deleted == NO” does not work as expected

耗尽温柔 提交于 2019-12-17 03:20:22
问题 I am using UIManagedDocument with Parent Child context. In my child context I do the following Code 1 NSSet *results = [self.event.memberships filteredSetUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { return ([[evaluatedObject deleted] boolValue] == NO); }]]; Above code returns the expected results (only Not deleted members for the event). Code 2 But this code does not. It fetches all records. NSPredicate *predicate = [NSPredicate

Core Data NSPredicate “deleted == NO” does not work as expected

流过昼夜 提交于 2019-12-12 03:55:11
问题 I am using UIManagedDocument with Parent Child context. In my child context I do the following Code 1 NSSet *results = [self.event.memberships filteredSetUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { return ([[evaluatedObject deleted] boolValue] == NO); }]]; Above code returns the expected results (only Not deleted members for the event). Code 2 But this code does not. It fetches all records. NSPredicate *predicate = [NSPredicate

CoreDataTableView Not Updating When Saving From Child ManagedObjectContext and Parent ManagedObjectContext

孤者浪人 提交于 2019-12-11 19:22:07
问题 I'm trying to populate CoreData from a JSON file with thousands of entries. What I'm trying to do is create a new NSManagedObjectContext with the parent property set to my main NSManagedObjectContext. Every so often I save on my child context and if successful then save on my main context. If that's also successful I try to reload my tableview. My CoreDataTableView is setup with an NSFetchedResultController and taken directly from Apple's documentation. However, the table view isn't refreshed

CoreData, UIManagedDocument and empty Persistent Store

佐手、 提交于 2019-12-10 12:08:18
问题 I'm using UIManagedDocument to reading and writing to CoreData . I have Document class. This is a document from some tutorial: .h #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> typedef void (^OnDocumentReady) (UIManagedDocument *document); @interface Document : NSObject @property (strong, nonatomic) UIManagedDocument *document; + (Document *)sharedDocument; - (void)performWithDocument:(OnDocumentReady)onDocumentReady; @end .m @interface Document () - (void)objectsDidChange:

UIManagedDocument: Error/crash on creating new files when network is down (saving)

廉价感情. 提交于 2019-12-10 10:25:33
问题 When I try to save a newly created UIManagedDocument to iCloud and the network is down (e.g. airplane mode) I get the following error(s) with a crash (hexcodes and unreadable stuff removed): -[PFUbiquitySafeSaveFile waitForFileToUpload:](272): CoreData: Ubiquity: <PFUbiquityPeerReceipt: ...>(0) permanentLocation: <PFUbiquityLocation: ...>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~domain~AppName/TransactionLog/mobile.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/DocumentName

UIManagedDocument with NSFetchedResultsController and background context

烈酒焚心 提交于 2019-12-06 15:56:32
问题 I am trying to get the following working. I have a table view that is displaying data fetched from an API in a table view. For that purpose I am using a NSFetchedResultsController: self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:self.database.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; I create my entities in a background context like this: NSManagedObjectContext *backgroundContext; backgroundContext = [

UIManagedDocument migrate data model

北战南征 提交于 2019-12-06 04:39:22
问题 I am working on an iPhone app that uses a subclass of UIManagedDocument and stores its documents on iCloud. It was all working fine until I changed my core data model / scheme (adding a new model version - like I had several times in the past few weeks). I added a new property and changed the data type of one of the existing properties. Now when I run my app I don't seem to be able to load my documents with UIManagedDocument 's -openWithCompletionHandler: . I can create new documents and read

UIManagedDocument OpenWithCompletionHandler never returns

佐手、 提交于 2019-12-06 04:03:58
I am running into a weird problem. I am sure that I did something to a file somewhere else in my code and it didn't close properly or something, but now it is in a state where it reports as being closed, but when I call OpenWithCompletionHandler it never returns. See below: //if the file is closed, open it and then set up the controller if (file.documentState == UIDocumentStateClosed){ //---- this code executes [file openWithCompletionHandler:^(BOOL success){ // ---- this code NEVER executes }]; } Any ideas? Joe See Bug in iPhone Simulator 5.1 with Xcode 4.5 using UIManagedDocument . My

UIManagedDocument Singleton Code openWithCompletionHandler called twice and crashes

时间秒杀一切 提交于 2019-12-06 01:44:44
问题 I am using Justin Driscoll's implementaion on Core Data with a Single Shared UIManagedDocument. Everything was fine in my iphone app until I moved it to a iPad storyboard and a splitview controller for the ipad app. The problem is openwithCompletionHandler is being called twice, once from my master view in viewDidLoad and again in my detail view viewWillLoad. The calls are in quick succession and since the document is still in UIDocumentStateClosed when the second call is made to my

UIManagedDocument saveToURL completionHandler is not called - Error message: “The reader is not permitted to access the URL.”

℡╲_俬逩灬. 提交于 2019-12-06 01:23:54
问题 I've got an old app that uses UIManagedDocument to interact with Core Data. However on iOS 11.2 (and possibly earlier iOS 11 point releases) the saveToURL:forSaveOperation:completionHandler: method seems to have stopped working both on-device and in the simulator (however it does still work in the iOS 10.3.1 simulator). Specifically, in the code below the completionHandler inside the first if statement is never executed (as NSLog messages indicate). - (void)useDemoDocument { NSURL *url = [[