Core Data Application Types

Hi all,
I'm working on an OSX app to be powered by Core Data (using SQLite) and I'm at the definition stage right now. I am struggling to find a definitive statement on what would be the right type of CD app to build. I have discounted the concept of building a foundation tool - I want to work with CD more directly. This leaves a few options on project set-up:
+ CD App
+ CD Doc Based App
+ CD Doc Based App with Spotlight
The app is reasonably complex and has some possibly relevant requirements:
1: Ability to have multiple save files e.g. File1.myapp, File2.myapp where you would load up your file and start working with the data (or create one of course). During the user session the user would add/edit data. On Add, the user will commit each set of entries once validated, and confirmed - I don't want it to auto save, the same goes for edits. Essentially, sheets etc will be in an "unsaved" state during usage, if that makes sense.
2: The data entered drives multiple views and reports, used by the user. These reports will be rendered as PDFs and exportable to disk/email.
3: Table views will be used on various views and a search box will be used to filter the output.
So, the question is which is the most appropriate path, and why (or am I barking up the wrong tree entirely)?
Hope that all makes sense, and thanks for your help,
Chris

@Chris S said:
1: Ability to have multiple save files e.g. File1.myapp, File2.myapp
Those sound a lot like docs to me....
a search box will be used to filter the output
sounds like spotlight to me...
I think you'll be quite happy going for the "+ CD Doc Based App with Spotlight "
this will just give you a better starting point, IMHO.... while the base code might not be exactly what you want, it gives you an example to work from (for docs and search) instead of working from nothing
Sounds to me like you're right on target, Chris....

Similar Messages

  • Edit and save a Core Data entity?

    Sorry if this is a fairly obvious issue, but I honestly can't find anything..
    Every sample Core Data application I've come across has examples of inserting and deleting entities/objects. But I cannot find anything about editing and saving some attributes of an existing object. Is this possible??
    I'm using default core data/managed objects, not custom classes yet. I can insert, view, and delete objects from the context. But I want to be able to edit attributes, and NOT in a table cell. I want to open the object in a separate window (which I can do), edit the attributes in that window, and click a "Save" button to update the attributes of that particular object. I can't find anything that shows me how.
    I am thinking a work-around would be to remove the existing object and just create a new object with the data, but if I have relationships to other objects, it seems like doing that would mess them up. My other train of thought is, if I can't do this with default core data objects, what CAN I do it with? Do I need to create custom classes for the objects, or do I need to use an SQL database separately?
    Thanks...

    Apple has this to say about that...
    Entity-relationship modeling is a way to describe data structures that can be mapped to an object-oriented system. Since it comes from the database world, there is some terminology that is associated with it that you may not be familiar with. These terms are:
    Entities, specific pieces of information in a data model.
    Attributes, the components of an entity. These are usually simple scalar types, such as int, float, or double; C structures such as char *, NSPoint; or an instance of a primitive class, such as NSString, or NSNumber.
    Relationships, references that an entity can have to other entities. These relationships can be optional or required as well as one-to-one or one-to-many.
    Properties, a collective term for attributes and relationships.
    -=-
    Entities and Managed Objects
    Each entity definition in a managed object model requires the name of the entity and the name of the class used at runtime to represent that entity.
    http://developer.apple.com/macosx/coredata.html
    do I need to use an SQL database separately?
    Core Data support three different kinds of data store formats to save managed objects contexts to. These formats are:
    • XML file format
    • Binary archive file format
    • SQLite database file format
    ...which are you using now? That is a rhetorical question for you to ponder, actually.

  • Core data psql or cgi bash?

    It's kind of getting down to the nitty gritty about selecting a data system for a project. The cgi stores data and makes requests for the client, as usual. The cgi is generating the content. The data required is pretty simple, and I was thinking of simply using bash commands to store and retrieve data. I also have psql already set up on the system, but I don't know or recognize what advantages that would offer. I could also make a core data application and access it via the cgi, or place the application in the cgi? I'm also not sure what advantages that would offer with relatively simple data sets. I'm not sure what the difference is between core data stores and core data xml stores, if they are more easily accessible, if they use less memory than xml, if there is an accessing overhead? It seems like the fastest way to get in and out of data from a cgi is to simply deploy one's own scripting and file system? Any charitable or wise advice or thoughts on this?

    Maybe the CGI isn't printing out a content-type header?

  • Core Data questions (NSNumber)

    Hi,
    I'm a bit lost with cocoa programming (have done C/C++ in University, now trying to get into the whole user interface thing). I'm trying to do a simple Core Data application but there are things I don't understand.
    First, I have an NSForm in my main window. I'd like the user to enter values in those. But, one of my entitie's attribute should be an interger. The thing is, the values in an NSForm field is a string. I know I can switch the attribute's type to string, but is there a proper way of doing this?
    Second, I have an NSTextField that shows an integer (again it's a string, I'd like it to be an integer). I placed a button next to it to increment that number by one each time it's clicked. At the same time, that field is binded to an attribute wich I'd like to be updated each time to keep track of everything. How do I program the incrementation thing in cocoa? I know Objecive-C quite a bit, but I don't know how to get the job done (what to connect to what, where to put my code, what to overide, etc...).
    Any help would be appreciated!

    Well, first of all, most interface components in Cocoa inherits from the class NSControl, in this class you can fin the method -intValue and -setIntValue: to respectively get and set an int value, if you send an -setIntValue: message to a text field it'll display your integer as a string. If you send a -intValue message to a text field it'll try to parse the number in the text field and will return it or 0 otherwise.
    For your incrementing I would tell you to use bindings, but in that case I would let you read the Apple Documentation because I never really use it so I can't explain it properly.
    So, I'm going to tell you the traditional way to make that work. According to MVC design pattern (Model-View-Controller), you would use 3 levels, but I'll make it simpler and use only 2.
    You have to create a new class which will be a Controller, to do this you go into Interface Builder, in the MainMenu.nib you click the Classes tab, you select NSObject in the left column, you go Classes menu and you do "Subclass NSObject". You put a name for your class.
    Then you open an inspector window, you go in Attributes part where you can see outlets and actions. You add one outlet for your text field of type NSTextField, and you add one action named increment: (the colon is added automatically).
    Then you click on your class again in the MainMenu.nib Classes tab and in the Classes menu you choose Instantiate <your class name>. You'll see a blue cube appear in the Instances tab.
    You hold ctrl key and click on the cube then you drag to your NSTextField (a line should appear between the cube and the cursor) you drop the line on the NSTextField and connect the text field to the outlet in your inspector window.
    You do the same for the button, except that this time you drag from the button to the blue cube and you select the action you defined earlier.
    There you are, everything is set up in IB, now go back into the Classes tab, select your class again and in Classes menu choose "Create files for <your class name>", choose your project and validate. Close IB and save your nib, go on Xcode, select <your class name>.m and inside it put the code into your increment method :
    [textField setIntValue: [textField intValue] + 1];
    textField should be replaced by the name of the outlet you put. Then you can execute and you'll have a beautiful text field which value will be incremented by clicking on the button.
    You can check the Cocoa Tutorial in Apple documentation, there's way more in it than in my post, and there's illustrations to make everything clearer.

  • Core Data Graphics

    Is there any way to store graphics in a core data application. I have created an application that can have a bunch of entries as if it were a blog or journal. I have everything hooked up using a text view (with graphics enabled) but if i go to save the application after putting an image in the text view it disappears(the image that is). I've tried changing the type of attribute in my data model to undefined, to binary data, and to string, yet nothing works. Is this even possible?
    Thanks
    Tom

    Hi,
    you have to store them as binary objects (NSData). I do that with PDFs and webarchives and it works very well. See "Core Data reference documentation" chapter "Non-Standard Attributes".
    Volker

  • Core Data Document Icon

    Hey guys,
    I have a document based Core Data application here. When I save a file as Binary/XML I get a standard blank file icon. How do I make sure the user sees a custom icon when saved from my app?
    TIA,
    Ricky.

    rickydamelio wrote:
    I have a document based Core Data application here. When I save a file as Binary/XML I get a standard blank file icon. How do I make sure the user sees a custom icon when saved from my app?
    You do this for a Core Data app just like you would for any other Cocoa application. And with a core data app most of the details should already be set up for you.
    Check out Storing Document Types Information in the Application's Property List for more info.
    First you need to create a .icns file containing the icon you want to use for your document. Then add the icns file to the Resources group of your Xcode project so when you build it will get copied into your application bundle. You can create a different .icns file for each type of document, or you can use the same icon file for all your document types if you want them to have the same icon.
    Next, expand the "Targets" group in Xcode, select your target and click the "Info" button in the toolbar. Select the "Properties" tab of the Info window. A core data app should already have three document types set up in the list at the bottom the window. Edit the "Icon File" column and add the file name of your .icns file for each document type.
    You may want to edit the "Name" column as well. Whatever you put here is what will show up as the "Kind" in the preview column if you select one of your documents in column view or if you do a "Get Info" on one of your documents.
    You can also change the "Extensions" column and the "OS Types" column to uniquely associate your documents with your application. But note that if you change these values then your application may have trouble opening _pre-existing documents_ that were created with the original extensions or types. You could manually rename an existing document to remove the old extension and add the new one. Or use the SetFile tool if you needed to change an pre-existing document's OS Type.
    The Finder probably won't pick up on these changes right away. You may have to logoff and log back on or force Finder to restart before your changes will be recognized.
    Steve

  • Core Data and Cocoa Binding

    Hello,
    I'm trying to make core data application and I refer to following url as test.
    http://developer.apple.com/cocoa/coredatatutorial/index.html
    However, I have following error.
    2011-03-04 00:32:01.476 XMLTest2CoreData[9954:a0f] An uncaught exception was raised
    2011-03-04 00:32:01.479 XMLTest2CoreData[9954:a0f] Cannot create BOOL from object (
    ) of class __NSArray0
    2011-03-04 00:32:01.481 XMLTest2CoreData[9954:a0f] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot create BOOL from object (
    ) of class __NSArray0'
    * Call stack at first throw:
    0 CoreFoundation 0x00007fff87de97b4 __exceptionPreprocess + 180
    1 libobjc.A.dylib 0x00007fff852cd0f3 objcexceptionthrow + 45
    2 CoreFoundation 0x00007fff87de95d7 +[NSException raise:format:arguments:] + 103
    3 AppKit 0x00007fff84830e78 _NSBoolFromValue + 443
    4 AppKit 0x00007fff848309a9 -[NSEditableBinder _setStatesImmediatelyInObject:mode:triggerRedisplay:] + 554
    5 AppKit 0x00007fff84830778 -[NSEditableBinder _observeValueForKeyPath:ofObject:context:] + 116
    6 AppKit 0x00007fff84775a33 -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 557
    7 AppKit 0x00007fff84752546 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1172
    8 AppKit 0x00007fff8475088d loadNib + 226
    9 AppKit 0x00007fff8474fd9a +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 248
    10 AppKit 0x00007fff8474fbd2 +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 326
    11 AppKit 0x00007fff8474d153 NSApplicationMain + 279
    12 XMLTest2CoreData 0x0000000100001089 main + 33
    13 XMLTest2CoreData 0x0000000100001060 start + 52
    terminate called after throwing an instance of 'NSException'
    Entity is only one "Title" and it has one attribute "name".
    My XCode is version 3.2.5.
    Please give me advice...
    Thank you.

    I have a new problem...
    I succeed to run the application, and save the data.
    But cannot open the saved data.
    In addition, The application doesn't ask anything as terminating it.
    I checked that I could save the data.
    </metadata>
    </databaseInfo>
    <object type="GENE" id="z102">
    <attribute name="name" type="string">PTEN</attribute>
    <attribute name="creationdate" type="date">321113984.72053700685501098633</attribute>
    <relationship name="mrna" type="1/1" destination="M_RNA"></relationship>
    <relationship name="protein" type="1/1" destination="PROTEIN"></relationship>
    <relationship name="title" type="1/1" destination="TITLE"></relationship>
    </object>
    <object type="TITLE" id="z103">
    <attribute name="name" type="string">PTEN</attribute>
    <relationship name="genelist" type="0/0" destination="GENE" idrefs="z102"></relationship>
    </object>
    </database>
    And I tried to check the log...
    but, I have only following message...
    2011-03-06 23:56:15.660 XMLTest2CoreData[14116:a0f] Application terminating.
    - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
    NSLog(@"Application terminating.");
    if (!managedObjectContext) {
    NSLog(@"managedObjectContext is nil...");
    return NSTerminateNow;
    if (![managedObjectContext commitEditing]) {
    NSLog(@"%@:%s unable to commit editing to terminate", [self class], _cmd);
    return NSTerminateCancel;
    if (![managedObjectContext hasChanges]) {
    NSLog(@"Application has not changed.");
    return NSTerminateNow;
    NSError *error = nil;
    if (![managedObjectContext save:&error]) {
    NSLog(@"Application terminating and attempting to save.");
    // This error handling simply presents error information in a panel with an
    // "Ok" button, which does not include any attempt at error recovery (meaning,
    // attempting to fix the error.) As a result, this implementation will
    // present the information to the user and then follow up with a panel asking
    // if the user wishes to "Quit Anyway", without saving the changes.
    Any advice would be helpful.
    Thank you.
    Message was edited by: Rascal3

  • Problem with core data and attribute name "description"

    I have spent hours tying to figure out this problem.
    It appears that is you name an attribute "description", there can be problems at run-time.
    Perhaps, it is related to how I am doing things and letting interface builder do all the bindings.
    I create a core data application in Xcode.
    I create the entity with some attributes in Xcode and then I launch interface builder. I drag a "core data entity" object to the application window. I add a "Master/Detail View".
    I save the files and do a compile. When I click on the "add" button, something goes wrong and GDB launches and loads the stack frame into the debugger.
    I am using Xcode 3.1.2.

    description is the name of a method in the NSObject protocol; try to use another name for your attribute in CoreData, for example myDescription.

  • How to implement parent entity for core data

    Hi there.
    I am starting a document-based Core Data application (Cocoa) and developed the following data model;
    The 'invoice' entity is a parent entity of 'items', because ideally I would want there to be many items for each invoice. I guess my first point here is - is what I am trying to do going to be achieved using this method?
    If so, I have been trying several ways in Interface Builder to sort out how to implement this structure with cocoa bindings. I have made a Core Data app before, just with one entity. So this time, I have two separate instances of NSArrayController's connected to tables with relevant columns. I can add new 'invoice' entities fine, but I can't get corresponding 'items' to add.
    I tried setting the Managed Object Context of the 'item' NSArrayController to this;
    I thought this would resolve the issue, but I still have found no resolution to the problem.
    If anyone done something similar to this, I'd appreciate any help
    Thanks in advance,
    Ricky.

    Second, when you create a Core Data Document Based application, XCode generates the MyDocument class, derivating from NSPersistentDocument. This class is dedicated to maintain the Managed Object Model and the Managed Object Context of each document of your application.
    There is only one Context and generally one Model for each Document.
    In Interface Builder, the Managed Object Context must be bound to the managedObjectContext of the MyDocument instance: it's the File's owner of the myDocument.xib Nib file.
    It's not the case in your Nib File where the Managed Object Context is bound to the invoiceID of the Invoice Controller.
    It's difficult to help you without an overall knowledge of your application, perhaps could you create an InvoiceItem Controller and bind its Content Set to the relationship of your invoice.

  • Core Data: Get Managed Object by unique part of the objectID

    In my Core Data application, I need to get the pointers to different managed objects whose CoreData objectIDs end with the number I provide. e.g.:
    Get the Person object whose objectID ends with unique number 317. The whole ID is:
    <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A/Person/p317>
    or I need to get Department object, which ends with 5; again full ID is:
    <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A/Department/p5>
    These numbers are actually primary keys in the SQLite database's tables and I can see them if I open the database directly with sqlite3, and I can of course select the records using SQL query;
    *but I can not figure out how to get these objects using CoreData. I guess I should create the NSPredicate for the fetch request; but I don't know how to write the predicate which will give me the exact object based on the unique part of the objectID*
    As I understand, objectIDs are not object's "normal" attributes.
    Please help. Thanks in advance.

    etresoft wrote:
    DavidMan wrote:
    *but I can not figure out how to get these objects using CoreData. I guess I should create the NSPredicate for the fetch request; but I don't know how to write the predicate which will give me the exact object based on the unique part of the objectID*
    I think you are supposed to consider the entire ID to be unique. You can retrieve the associated object using "objectWithID:" from NSManagedObjectContext.
    The problem is that I am parsing the text from another application and I have only the "unique part" at hand and not the whole objectID. So, I need to cope with that.
    What I see is that the IDs of every entity start with the same text, e.g. here are the IDs of two different entities:
    <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A/Person/p317>
    <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A/Department/p5>
    As you see, the difference is only in the end, after the entity names "Paper" and "Department". But this is my case and I am not completely sure that this will hold true for EVERY future installation on any system for every entity.
    *Question: will the part like <x-coredata://A3EDF6C1-229D-4658-A04E-598ADF1C749A be constant for the particular installation, for every entity/object?*
    If YES, then I will:
    - after getting any/first object, extract the non-unique part, i.e. <x-coredata...749A which is the same for every object in this particular installation on this particular computer
    - get the unique part, i.e. /Person/p317, /Person/p23, /Department/p5 etc.
    - synthesize the "real ID" by appending these two strings
    - ask managedObjectContext to return the object with this ID
    - continue with the acquired object
    How does it sound? Will this work on other computers?
    P.S. FYI: the coredata of this program has only one store i.e. all the data are stored in single sqlite file.

  • Upgrade of Core Services Application Configuration Data in Yosemite

    anybody knows if the upgrade of Core Services Application Configuration Data in Yosemite can be forced?
    Due the my Matlab2012a failure to start, Mathworks advises to have a new version of the Core Services Application Configuration Data. They stated that a new version, a few hours after Yosemite installation would have been autoinstalled (Core Services Application Configuration Data 10.10", Version 10.39 or later!).  I have setted the OS X system autodownload and installation, but after all these day my version is 1.025 and I do not see any 10.10 or 10.9 reference. The many Download trials by AppStore are completely unsuccessful at this moment.

    Hi friends.
    Also if the Core Services Applications Data Configurations is not updated yet after many and many days since the Yosemite Installation on my iMac, I have solved my Matlab2012a problem thanks to the wonderful Mathworks Support (in particular Daniel Vandenbulcke of the Mathworks Installation Support). I describe the steps needed for starting Matlab2012a (this is the last version as to my knowledge to use XQuarz)
    1. Uninstall any version you have of Xquarz and X11 if you have them already installed
    2. Download and install the latest version of XQuarz
    3. Go to the Applications and select the Matlab2012a.app
    4. right-click, then open the package content and go to  Contents/MacOS
    5. duplicate the StartMATLAB making an alias (StartMATLAB.alias) then drag this copy to the Desktop or another location
    6. double-click on this alias and the Terminal window will open and start the program
    I hope this will solve also your problem.
    Though: No help from Apple people for the Core ...problem.

  • Core data: Versioned model migration with change in existing attribute data types.

    Hi ,
    I want to upgrade my ios app with app store version with enhancement of new functionality related to core data features in the app.
    -In new upgarde version, I want to change data types of attribute which is already present in core data model of existing app store version.
    e.g.In Version 1.0 ,Attribute "date" datatype is "NSDate", New change required to change  datatype "NSDate" to "NSString" with new version model.
    I followed Lightwaight migration, but as per documentation , Lightwaigh migration not support for change data type of any existing attribute/entity of core data model.
    Please suggest optimized solution for migration of database along with change in data type of exsiting attribute of the entity in core data.
    If required in further info ,please ask.
    Thanks in advances.
    Regards,
    Laxmikant

    More Info: The two entries are actually pointing to the same object. If I save the context and restart, I only have one entry (I can also see this by looking at the XML store).
    It seems that the NSTableView is getting messed up somehow after the FetchRequest. Still stumped.

  • Core Data: "Allows external storage" for Transformable type?

    When I create a Core Data attribute, and set its type to "Transformable", the "Allows external storage" option is unavailable. I only see it available for Binary type.
    How can I use "Allows external storage" with Transformable type?

    I wanted to post an update and let everyone know what I decided on and how well it works.
    I went with the following setup.
    eSATA Express Card
    http://www.newegg.com/Product/Product.aspx?Item=N82E16839200006
    eSATA enclousure
    http://www.newegg.com/Product/Product.aspx?Item=N82E16817173043
    eSATA drive
    http://www.newegg.com/Product/Product.aspx?Item=N82E16822136218
    All of this cost me a total of $159.57 for about 600gigs of high performance storage after being formated! I did some benchmarks and the drive is performing faster than my internal 7200rpm drive. It is not much faster but it is faster.
    So I would have to say that if you really want some fast performing drives for just about anything eSATA is probably the way to go.
    About the items,
    The eSATA card looked used when i got it. The seal was broken and the item was dirty and had finger prints on it. It was however very easy to install. I just downloaded the newest drivers from rosewill.com plugged it in and it worked.
    The hard disk enclosure seems well made and was a breeze to setup and install. It also does usb 2.0 if you need it. It has as a big cooling fan and includes a usb and sata cable as well as a eSATA bracket for your desktop pc.
    All in all a great buy. So thank you again for all the info

  • Should I use Core Data?

    I'm starting a new document-based application. Is Core Data the way of the future, or just a convenience for specific types of apps? That is, in the "old days" you would override -[NSDocument dataOfType:] and readFromData: to archive your objects. It seems appealing to use Core Data and get automatic archiving in XML, SQL, and binary all for free, but the tutorials I've gone through all seem directed at a very different kind of app than mine. (Rather database-like, but I suppose the demo has to look like something.) The old "Sketch" example, which uses old-style archiving, hasn't been updated in years. Which direction to go?

    Look up HyperCard in Wikipedia for a good explanation. In short, I'm developing a GUI-based mini-app environment, where users can create buttons & fields, and hook them up with an elementary scripting language. I've written the compiler & interpreter, am starting the surrounding framework.
    "Have you looked at the Apple HIGs lately?" Dude, I was reading "Inside Macintosh" back in 1984.
    Mobile platform? Since I'm using garbage collection, I'm shut out of iPhone/iPad, at least for the time being.

  • Core Data errors when loading saved files

    Hi there.
    I am working on a fairly simple Core Data document-based application that I am working on. Some files have been previously saved (in the same version of the app) using the SQLite and XML file types, but now cannot be reopened.
    The following error appears in the application;
    {quote}"The document “Test” could not be opened. The file isn’t in the correct format. The file might be corrupted, truncated, or in an unexpected format."{quote}
    The files themselves only have some text in them, and that is all.
    Does anyone know of a reason why these files cannot be reopened after saving them?
    Thanks in advance,
    Ricky.

    Does anyone know of a reason why these files cannot be reopened after saving them?
    Did you check to see if the file type/suffix was modified or perhaps added and then made invisible. Example: 'myfile.sql.txt' - do a get info, show suffix and double check that what you see is what you want. Also check permissions while you're there.
    If that fails, go to your backups and be careful how you modify your dbs in the future...don't just whack them with a text editor, etc.

Maybe you are looking for