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
1
vote
2 answers

NSPersistentDocument to be marked as not "dirty"/edited after internal initiation

I have a NSPersistentDocument (CoreData) that I initiate before I present it to the user. That means that I create some internal core data objects and add them to the document/persistent store/managed object context. However, that means that even if…
Wizard of Kneup
  • 1,863
  • 1
  • 18
  • 35
1
vote
1 answer

Core Data: Lost the ability to save new documents, but still can edit and save existing documents

I am currently developing the first version of an application using NSPersistentDocument and lightweight migration. The data model went up to version 12 now. When switching from version 9 to version 10, I lost the ability to save new documents, but…
1
vote
1 answer

Getting the managedObjectContext in a document-based app for preferences controller

I've got an OSX document-based app, written in Swift and would like to submit some data from my preferences window controller into my managedObjectContext. Because the preferences window doesn't seem to be invoked through the NSPersistentDocument,…
1
vote
1 answer

NSPersistentDocument crash on “save as”

My Core Data document-based application crashes on "save as". The problem seems similar to the one described in the cocoa-dev thread titled "NSPersistentDocument objects "gutted" after Duplicate, Rename in 10.9" The key differences being that: I…
Pierre Bernard
  • 3,148
  • 2
  • 23
  • 31
1
vote
1 answer

How do I make sure a documents window remembers its position

I am using a standard AppKit NSPersistentDocument document base application and would like a document's window to remember its location and open in the same position it was last closed in. Note that setting the autosavename in IB on the Window will…
Duncan Groenewald
  • 8,496
  • 6
  • 41
  • 76
1
vote
0 answers

How to save a setting into Core Data when a document is closed

I have a variable that gets changed a lot that I have therefore pulled out of my core data database (it's just an int but it gets updated very regularly). My app is NSPersistentDocument based and when the user closes a document I would like to save…
Mark Wheeler
  • 587
  • 2
  • 6
  • 19
1
vote
1 answer

How to preload data from Core Data in a NSPersistentDocument?

I have a NSPersistentDocument with a given Core Data model, etc. I have a file, created by this document, let's say it its preload.xml. It "contains" several NSManagedObjects. I would like to load these objects in all my new documents, so that when…
Colas
  • 3,473
  • 4
  • 29
  • 68
1
vote
0 answers

How do I setup Magical Record in a NSPersistentDocument app?

I'm learning to develop cocoa apps, yet I'm jumping straight to Core Data. Well, it seems to be the right way to write the app I want. So, I've been looking into Magical Record and found this really helpful tutorial which explains how to setup…
1
vote
0 answers

Core data lightweight migration not working

I have an app that is working with core-data. At the moment I'm on V1.5, during those versions I've made some changes to the core database. After some complaints of people that the app is still crashing I found out that I should have implemented…
Steaphann
  • 2,797
  • 6
  • 50
  • 109
1
vote
0 answers

distinguish use cases in NSAutosaveElsewhereOperation

I try to add AutoSave support to the Core Data File Wrapper example Now if i have a new/untitled document writeSafelyToURL is called with the NSAutosaveElsewhereOperation type. The bad thing is, I get this type in both typical use cases - new…
Stephan
  • 4,263
  • 2
  • 24
  • 33
1
vote
1 answer

New project New Model NSPersistentDocument This NSPersistentStoreCoordinator has no persistent stores

I have been searching stackoverflow and Googling for hours. I made a simple project to mess around with Core Data and bindings. It added an entity to the model and it wouldn't work any more. I was getting "This NSPersistentStoreCoordinator has no…
1
vote
1 answer

File changes on disk when opened by app with updated Core Data model

I have an OS X app that relies on NSPersistentDocument and Core Data to handle the app's custom file type (which is being saved as XML). I've noticed that when I update my Core Data model (I'm making simple changes, relying on lightweight migration)…
Dale Beck
  • 86
  • 4
0
votes
1 answer

CoreData autosaving and not loading all data after autosave

I have an NSPersistentDocument subclass using NSManagedObject subclasses for my data. When a new document is opened, I do some initializing of data structures (trivial amount of populating fields). What I've noticed is that the Untitled document…
Tyler A.
  • 3,048
  • 1
  • 23
  • 27
0
votes
1 answer

Undo manager not up to date with NSPersistentDocument

I have some calculated values in the core data database that I need to update just before saving. Basically I'm numbering some entities in order to ease up the navigation between them. Currently I'm observing…
mkko
  • 4,262
  • 3
  • 25
  • 29
0
votes
1 answer

Handling command line arguments from NSPersistentDocument

I've an application based on NSPersistentDocument, it has three different views based on diffrent conditions and data and every works fine. Now the customer also wants to run the application from shell scripts. For example open -a myapp.app --args…
dafi
  • 3,492
  • 2
  • 28
  • 51