Questions tagged [nspersistentdocument]

NSPersistentDocument is a subclass of NSDocument intended to work with Core Data.

NSPersistentDocument is part of Apples Framework.

It is a subclass of that is intended to work with . It provides access to a document-wide object.

71 questions
2
votes
2 answers

NSPersistentDocument FetchRequest warp property crash on macOS Document App SwiftUI project

Project create usinging Xcode macOS Document App template, with Use Core Data checkbox checked. Add a Book entity to Document.xcdatamodeld Add FetchRequest warp property to ContentView, @FetchRequest(entity: Book.entity(), sortDescriptors: []) var…
Donly
  • 55
  • 8
2
votes
0 answers

In 2020, how does one sync a NSPersistentDocument based app across devices (macOS, iOS)

Suppose a macOS application using NSPersistentDocument (thus CoreData). All user data is stored in . files. In 2020, if I were to develop an iOS version of the application, how could I provide the functionality to the users to…
vomi
  • 993
  • 8
  • 18
2
votes
1 answer

Binding NSArrayController to moc in NSPersistentDocument subclass in Xcode4 in XIB view

I have my subclass of NSPersistentDocument who's superclass has [self managedObjectContext] Trying to set the bindings of my NSArrayController in the xib. When I set the Parameter's Moc, the bind to choices are: File's Owner, App, and Prefs. (The…
2
votes
1 answer

iCloud NSDocument save warnings - caused by lastUsedDate file attribute?

I have an app that uses NSPersistentDocument (without autosaving) on OS X and UIDocument (also without autosaving) on iOS. The file representation is Binary Core Storage. This app has been working fine since iOS 7 + macOS 10.10. If I open a document…
MichaelR
  • 1,681
  • 15
  • 28
2
votes
3 answers

"Save As" does not work for my NSPersistentDocument application

I have an OS X application that uses a subclass of NSPersistentDocument to store data. The Core Data persistent store type is SQLite. I am relying on the standard menu commands that get created when you create a new project for a document-based…
Dirk
  • 2,335
  • 24
  • 36
2
votes
2 answers

How to deactivate window restoration?

I am using SDK 10.8. I am subclassing NSPersistentDocument (but the question might interest people sublassing NSDocument) and I want to deactivate the window restoration. So far, here is what I have done : -(void)restoreStateWithCoder:(NSCoder…
Colas
  • 3,473
  • 4
  • 29
  • 68
2
votes
2 answers

Where to get managed object context in NSPersistentDocument?

It seems there's spotty information out there for using Core-data with Document based apps. I have a window controller that runs a modal window in the current document. The user enters data into a text field, which creates a mutable array of…
2
votes
0 answers

NSInternalInconsistencyException This NSPersistentStoreCoordinator has no persistent stores

I am initializing my model. If the local DB does not exists then I query my back end server to retrieve data and store in the core data (the first if statement). But I get the "NSInternalInconsistencyException This NSPersistentStoreCoordinator has…
Shirish Kumar
  • 1,532
  • 17
  • 23
2
votes
1 answer

Coredata & NSPersistentDocument: Sum of column numbers crash

I have a problem with a @sum binding of a column in my program: I'm doing a Coredata, NSPersistentDocument based program. I'm doing mostly everything from IB, the creation of the data model, NSArrayController and NSTableView... I have just 1 entity…
Luis Palacios
  • 396
  • 1
  • 3
  • 14
2
votes
2 answers

NSDocument based application and NSToolbar

I have application based on NSDocument (NSPersistentDocument), in application I can create (as usually) more than one document. Main document window (based on NSPersistentDocument) has, added IB, toolbar. In code I add to toolbar item…
1
vote
1 answer

CoreData not setting type as XML

I'm having a hard time debugging a problem with my data (CoreData, NSPersistentDocument). I have a subclass of NSPersistentDocument. I am using NSManagedObject subclasses / standard Core Data models. I'm not doing anything special in…
Tyler A.
  • 3,048
  • 1
  • 23
  • 27
1
vote
0 answers

Cocoa (Mac): splitting / combining a core data based application from / into multiple save files

I'm working in OS X Lion on a Core Data based Cocoa application where I need to be able to save different parts, lets say partA and partB, of the data model into separate files. I need to be able to save both files together as a project…
Taco
  • 106
  • 1
  • 2
1
vote
3 answers

Is -makeWindowControllers the best place to initialize an NSPersistentDocument?

When loading an existing document using NSPersistentDocument, as part of initialization I'd like to prepare some content: NSFetchRequest *req = [NSFetchRequest fetchRequestWithEntityName:@"DocumentRoot"]; NSArray *results =…
paulmelnikow
  • 16,895
  • 8
  • 63
  • 114
1
vote
2 answers

NSPersistentDocument – how to access the window?

I want to set some properties of the window of my NSPersistentDocument object. How do I get access to it? Is there a better way than like this? [[[[self windowControllers] objectAtIndex:0] window] setBackgroundColor:[NSColor blueColor]];
tamasgal
  • 24,826
  • 18
  • 96
  • 135
1
vote
3 answers

How do you correctly update a model in Xcode4 without corrupting it?

I never had any problems with Xcode3, but with Xcode4 I'm getting Apple's code failing approx 1 time in 3 when I update a core data model, with the dreaded "Persistent store migration failed, missing source managed object model." error. Here's my…
Adam
  • 32,900
  • 16
  • 126
  • 153