Core data refuses to work

hi.
I have a very simple model, it contains 1 entity with 4 attributes.
I have created an ObjectController in IB, and bound it to my persistent document's object context.
I follow this code (found in the core data documentation)to get a reference to the Object, and to set/get values:
NSManagedObject *myDoc = [NSEntityDescription insertNewObjectForEntityForName:@"BKSketchDocMO" inManagedObjectContext:[dataSource managedObjectContext]];
thePanX = [[myDoc valueForKey:@"docPanX"] floatValue];
[myDoc setValue:[NSNumber numberWithFloat:[self bounds].size.width/2] forKey:@"docPanX"];
now we come to the problem.
its doesn't work. theres an entity. I can get a reference to it, and it ALWAYS has the default values. NOTHING i do changes the values, NOTHING i do gives me anything Except the default values.
and since core data is basically a black box... I CAN"T DEBUG IT.
can anyone, shed any light on anything that might explain why I can get the object, get values, but I cannot set values?
signed,
getting frustrated by the core data double-talk and general lack of any real, and useful documentation.
Message was edited by: Edward Devlin1

Hi kids, yet again I have answered my own question. in my application, I could not make my object graph self populate, and then when i did get it to populate programatically, I could not access the data.
I have solved both problems. one was a conceptual problem, and the other was operator error building off of a conceptual problem.
first, lets tackle why my object graph doesn't auto populate. in IB i made an Object controller, and I hooked it up to my entity. I told the controller to automatically prepare content. I had assumed that it meant that when my Object Context was instantiated, it would automatically create an instance of my referenced object. this is Not how core data works. Currently i am working under the impression that "automatically prepares content" mean that when an entity is instantiated, it will fill out the appropriate values, with the defaults you set up in your object model.
so core data Does not actually instantiate anything for you. once I made this conceptual leap, I was still hazy on the implementation. I tried adding new entities upon initialization, but that tended to over-write entities opened from a saved document. in the end, I simply settled on making sure the entity existed when i tried to access its information. If it didn't exist I made one before trying to access it. in practice, this is a very slick and robust solution.
now for problem #2... every time I tried to access my data, it is like it was zeroed out to the default settings.
well, thats exactly what was happening. my entity was valid, I was making changes to it, and I was still getting the default values back. How was this happening? I didn't understand what i was doing.
heres what I thought was happening. I thought I was making a new ManagedObject, and filling it with the values of the entity I was trying to access, then I got the values from that ManagedObject, and discarded it.
What was really happening: If you look at my code, you'll see a method called : "insertNewObjectForEntityForName:" this is the method I THOUGHT was going to my ObjectContext, getting my entity and creating a ManagedObject from it for me to interface with. Clever coders will see the problem right away. Insert new Object? I was creating a new instance of my entity each time i Thought I was accessing the original. holy crap! of course I was only getting the default values... and sure I was able to make a change to the values, but the next time I tried to access them, I would just get a new entity, filled with default values!
so InsertNewObject, was the wrong approach... what turned out to be the correct approach? heres why i was having such a bad time of this... NSDictionary, is roughly analogous to Core Data. I have alot of experience w/ NSDictionary, and so i expected a straight forward... give me an object based on this key method. I understood that i was going to have to work through a proxy, but I had assumed a little too much about how Core data works. its not like NSDictionary at all. it works much more like a search engine... you tell it where, and what to look for and it will bring you back a list of things that are kinda like what you're looking for.
This is called a fetch request. Its a much more elaborate way to look for stuff than a simple objectForKey: method. its how you get your information from core data. Information comes back as an array of NSManagedObjects. The documentation made everything so much more difficult because it spoke of fetched values as something extra or added on to core data. Kids say it along w/ me.... fetch requests are how you get info from core data. repeat.

Similar Messages

  • Core data binding not working

    in my project I used core data and binding to produce data on document based program.
    I have used multiple entities and they worked fine and then they stopped working and I don't know why.
    all the text fields now have "()" in them with space in between them, and will not add to the database.  so the field shows a junk value and will not bind properly to the database.
    how would I start to debug this I have been searching but I don't know where to start, mainly i dont know what the problem is.

    Binding works one way. This means that textInput.text changes
    to match the value of account.identifier, not the other way around.
    While I think it's theoretically possible to create a binding the
    other way (I haven't played with binding in ActionScript), it makes
    more sense to listen to the TextInput's change event to get changes
    to the text field.
    Or, you can create a model in the MXML and bind one its
    properties to the textinput's value. Look in the docs about the
    mx:Model tag for details.

  • Core data and Populate field programmatic

    Hi
    On a window i have a couple of controls Combo box, Text field and a few buttons
    all linked to core data which is working perfect ish
    if I select the combo box and change the value its updated in core data straight away
    if I press a button it put a value in the text box but doesn't update the code data field until i click in the field and add a space or something simular ..
    is it a focus thing, the field don't lose focus until I have done it manually
    can someone point me in the right direction for this
    just want to click a button , put that value in the textbox and core data is updated without having to click in the text box
    regards
    Tony

    Does this help?

  • IPhone core data - fetched managed objects not being autoreleased on device (fine on simulator)

    I'm currently struggling with a core data issue with my app that defies (my) logic. I'm sure I'm doing something wrong but can't see what. I am doing a basic executeFetchRequest on my core data entity, but the array of managed objects returned never seems to be released ONLY when I run it on the iPhone, under the simulator it works exactly as expected. This is despite using an NSAutoreleasePool to ensure the memory footprint is minimised. I have also checked with Instruments and there are no leaks, just ever increasing allocations of memory (by '[NSManagedObject(_PFDynamicAccessorsAndPropertySupport) allocWithEntity:]'). In my actual app this eventually leads to a didReceiveMemoryWarning call. I have produced a minimal program that reproduces the problem below. I have tried various things such as faulting all the objects before draining the pool, but with no joy. If I provide an NSError pointer to the fetch no error is returned. There are no background threads running.
    +(natural_t) get_free_memory {
        mach_port_t host_port;
        mach_msg_type_number_t host_size;
        vm_size_t pagesize;
        host_port = mach_host_self();
        host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
        host_page_size(host_port, &pagesize);
        vm_statistics_data_t vm_stat;
        if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) {
            NSLog(@"Failed to fetch vm statistics");
            return 0;
        /* Stats in bytes */
        natural_t mem_free = vm_stat.free_count * pagesize;
        return mem_free;
    - (void)viewDidLoad
        [super viewDidLoad];
        // Set up the edit and add buttons.
        self.navigationItem.leftBarButtonItem = self.editButtonItem;
        UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject)];
        self.navigationItem.rightBarButtonItem = addButton;
        [addButton release];
        // Obtain the Managed Object Context
        NSManagedObjectContext *context = [(id)[[UIApplication sharedApplication] delegate] managedObjectContext];
        // Check the free memory before we start
        NSLog(@"INITIAL FREEMEM: %d", [RootViewController get_free_memory]);
        // Loop around a few times
        for(int i=0; i<20; i++) {
            // Create an autorelease pool just for this loop
            NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
            // Check the free memory each time around the loop
            NSLog(@"FREEMEM: %d", [RootViewController get_free_memory]);
            // Create a minimal request
            NSEntityDescription *entityDescription = [NSEntityDescription                                                 
                                                  entityForName:@"TestEntity" inManagedObjectContext:context];
            // 'request' released after fetch to minimise use of autorelease pool       
            NSFetchRequest *request = [[NSFetchRequest alloc] init];
            [request setEntity:entityDescription];
            // Perform the fetch
            NSArray *array = [context executeFetchRequest:request error:nil];       
            [request release];
            // Drain the pool - should release the fetched managed objects?
            [looppool drain];
        // Check the free menory at the end
        NSLog(@"FINAL FREEMEM: %d", [RootViewController get_free_memory]);
    When I run the above on the simulator I get the following output (which looks reasonable to me):
    2011-06-06 09:50:28.123 renniksoft[937:207] INITIAL FREEMEM: 14782464
    2011-06-06 09:50:28.128 renniksoft[937:207] FREEMEM: 14807040
    2011-06-06 09:50:28.135 renniksoft[937:207] FREEMEM: 14831616
    2011-06-06 09:50:28.139 renniksoft[937:207] FREEMEM: 14852096
    2011-06-06 09:50:28.142 renniksoft[937:207] FREEMEM: 14872576
    2011-06-06 09:50:28.146 renniksoft[937:207] FREEMEM: 14897152
    2011-06-06 09:50:28.149 renniksoft[937:207] FREEMEM: 14917632
    2011-06-06 09:50:28.153 renniksoft[937:207] FREEMEM: 14938112
    2011-06-06 09:50:28.158 renniksoft[937:207] FREEMEM: 14962688
    2011-06-06 09:50:28.161 renniksoft[937:207] FREEMEM: 14983168
    2011-06-06 09:50:28.165 renniksoft[937:207] FREEMEM: 14741504
    2011-06-06 09:50:28.168 renniksoft[937:207] FREEMEM: 14770176
    2011-06-06 09:50:28.174 renniksoft[937:207] FREEMEM: 14790656
    2011-06-06 09:50:28.177 renniksoft[937:207] FREEMEM: 14811136
    2011-06-06 09:50:28.182 renniksoft[937:207] FREEMEM: 14831616
    2011-06-06 09:50:28.186 renniksoft[937:207] FREEMEM: 14589952
    2011-06-06 09:50:28.189 renniksoft[937:207] FREEMEM: 14610432
    2011-06-06 09:50:28.192 renniksoft[937:207] FREEMEM: 14630912
    2011-06-06 09:50:28.194 renniksoft[937:207] FREEMEM: 14651392
    2011-06-06 09:50:28.197 renniksoft[937:207] FREEMEM: 14671872
    2011-06-06 09:50:28.200 renniksoft[937:207] FREEMEM: 14692352
    2011-06-06 09:50:28.203 renniksoft[937:207] FINAL FREEMEM: 14716928
    However, when I run it on an actual iPhone 4 (4.3.3) I get the following result:
    2011-06-06 09:55:54.341 renniksoft[4727:707] INITIAL FREEMEM: 267927552
    2011-06-06 09:55:54.348 renniksoft[4727:707] FREEMEM: 267952128
    2011-06-06 09:55:54.702 renniksoft[4727:707] FREEMEM: 265818112
    2011-06-06 09:55:55.214 renniksoft[4727:707] FREEMEM: 265355264
    2011-06-06 09:55:55.714 renniksoft[4727:707] FREEMEM: 264892416
    2011-06-06 09:55:56.215 renniksoft[4727:707] FREEMEM: 264441856
    2011-06-06 09:55:56.713 renniksoft[4727:707] FREEMEM: 263979008
    2011-06-06 09:55:57.226 renniksoft[4727:707] FREEMEM: 264089600
    2011-06-06 09:55:57.721 renniksoft[4727:707] FREEMEM: 263630848
    2011-06-06 09:55:58.226 renniksoft[4727:707] FREEMEM: 263168000
    2011-06-06 09:55:58.726 renniksoft[4727:707] FREEMEM: 262705152
    2011-06-06 09:55:59.242 renniksoft[4727:707] FREEMEM: 262852608
    2011-06-06 09:55:59.737 renniksoft[4727:707] FREEMEM: 262389760
    2011-06-06 09:56:00.243 renniksoft[4727:707] FREEMEM: 261931008
    2011-06-06 09:56:00.751 renniksoft[4727:707] FREEMEM: 261992448
    2011-06-06 09:56:01.280 renniksoft[4727:707] FREEMEM: 261574656
    2011-06-06 09:56:01.774 renniksoft[4727:707] FREEMEM: 261148672
    2011-06-06 09:56:02.290 renniksoft[4727:707] FREEMEM: 260755456
    2011-06-06 09:56:02.820 renniksoft[4727:707] FREEMEM: 260837376
    2011-06-06 09:56:03.334 renniksoft[4727:707] FREEMEM: 260395008
    2011-06-06 09:56:03.825 renniksoft[4727:707] FREEMEM: 259932160
    2011-06-06 09:56:04.346 renniksoft[4727:707] FINAL FREEMEM: 259555328
    The amount of free memory reduces each time round the loop in proportion to the managed objects I fetch e.g. if I fetch twice as many objects then the free memory reduces twice as quickly - so I'm pretty confident it is the managed objects that are not being released. Note that the entities that are being fetched are very basic, just two attributes, a string and a 16 bit integer. There are 1000 of them being fetched in the examples above. The code I used to generate them is as follows:
    // Create test entities
    for(int i=0; i<1000; i++) {
        id entity = [NSEntityDescription insertNewObjectForEntityForName:@"TestEntity" inManagedObjectContext:context];
        [entity setValue:[NSString stringWithFormat:@"%d",i] forKey:@"name"];
        [entity setValue:[NSNumber numberWithInt:i] forKey:@"value"];
    if (![context save:nil]) {
        NSLog(@"Couldn't save");
    If anyone can explain to me what is going on I'd be very grateful! This issue is the only only one holding up the release of my app. It works beautifully on the simulator!!
    Please let me know if there's any more info I can supply.

    Update: I modified the above code so that the fetch (and looppool etc.) take place when a timer fires. This means that the fetches aren't blocked in viewDidLoad.
    The result of this is that the issue happens exactly as before, but the applicationDidReceiveMemoryWarning is fired as expected:
    2011-06-08 09:54:21.024 renniksoft[5993:707] FREEMEM: 6131712
    2011-06-08 09:54:22.922 renniksoft[5993:707] Received memory warning. Level=2
    2011-06-08 09:54:22.926 renniksoft[5993:707] applicationDidReceiveMemoryWarning
    2011-06-08 09:54:22.929 renniksoft[5993:707] FREEMEM: 5615616
    2011-06-08 09:54:22.932 renniksoft[5993:707] didReceiveMemoryWarning
    2011-06-08 09:54:22.935 renniksoft[5993:707] FREEMEM: 5656576

  • Best path for Core Data implementation

    Hi all,
    First post so pls go easy!
    I'm a seasoned Windows/Web App developer who has recently (3-4m) discovered Mac, Cocoa and Obj-C. I've been buried in Apple docs, Hillegass and Dalrymple books for some time now trying to get to the point where I'm ready to build the Cocoa project that I have in mind, which looks to be well suited to a Core Data based Application driven by SQLite. The data model is reasonably complex with around 10 inter-related entities which must retain data integrity.
    Anyway, onto the question... historically I would have built a class library to encapsulate the use of the data model and accessed that class library when events fired to do what needs to be done. The Cocoa solution appears to support this - presumably though creating my own framework that is then referenced by the Cocoa application. I can see though that there is another path where I skip the encapsulation and build a Core Data based Cocoa app directly.
    At a high level - is there a preference between the two approaches?
    The latter seems well documented/supported but I am synically thinking that is because it is more straightforward and clearly faster, are there other advantages such as performance.
    For background the app when running will follow similar form to Mail.app in terms of multi-view with some data tables and custom views in play.
    Thanks,
    Chris

    Hi K T - thanks.
    Bottom line I think is that encapsulation is a safety blanket that I probably need to let go of. CD ticks boxes on a theory level, subject to implementation not being too heavy it seems like the logical step. The only consideration was to encapsulate a framework built on the known methods, then move the framework to CD under the covers when ready - that seems a bit gutless though and almost definitely inefficient time wise. I guess that there is little point in encapsulating CD from the outset - feel like it just adds unnecessary work in addition to some degree of performance overhead?
    {quote}Are you looking for flexibility or performance, by the way?{quote}
    Performance - the data model is unlikely to change once bedded in beyond addition of properties etc very infrequently. The app is likely to need to handle many tens of thousands of rows of data (albeit small in terms of data volume per row) for some users, and my conclusion from the documentation was that SQLite is the most appropriate route if committing to CD where data volume and/or relationships are plentiful. Is that a fair assessment?
    {quote}Are you looking to mimic traditional application interfaces or to adopt trends that are currently unfolding?{quote}
    The app I plan to build desperately needs to be brought up to date - possibly even beyond the advanced UI that AppKit seems to offer by default IMO. That said I don't want to overcommit on the extent of the build, but I do want to turn heads without just slapping coverflow or similar in for the sake of it. If you have any references or examples for doable leading edge UI design on OSX they would be gratefully received.
    Thanks again for your help - really appreciate it.
    Chris

  • Adobe update refuses to work for CS6 and Photoshop elements. App manager refuses to install.

    Adobe update refuses to work for CS6 and Photoshop elements. App manager refuses to install. Support Advisor is of no help.Anyone had the same problem? It has all worked perfectly for some years now, but refuses this week.Has Adobe changed something.Windows 7.

    Re: Adobe update refuses to work for CS6 and Photoshop elements. App manager refuses to install.
    created by Pat Willener in Downloading, Installing, Setting Up - View the full discussion
    What exactly means "refuses"?
    This is the message which comes up if I try to update (from the Help menu) or re-install my licenced copies of CS6 or Photoshop Elements 9.
    “We've encountered the following issues
    Installer failed to initialize.Please download Adobe Support Advisor to detect the problem”
    Get Adobe Support Advisor”
    OR
    on trying to open PhotoshopCS6 I get this message:-
    “Adobe Application Manager required to start your trial, is missing or damaged.
    Please download a new copy of Adobe Application Manager from http://www.adobe.com/go/applicationmanager_uk”
    When I follow these instructions and try and start up/install or update Photoshop CS6 I get the same messages all over again. This has been going on since Tuesday afternoon and I am anxiuous to resolve the problem. For several years now all this has worked perfectly through your website and I cannot understand what has changed.  Once I cancel these messages the products themselves seem to function OK. When I attempt to use Adobe Update Manager I get the same messages as above. You will see that my products are properly licensed and up to date. Have you any solution?

  • Adobe Media Core CS6 has stopped working

    Hi Folks,
    I'm running Adobe Creative suite CS6 on Windows 7, Dell T7600 with 64G RAM. Quicktime Pro 7.74, up to date.
    When I try to export a sequence using Quicktime as the Export format, I get the error, 'Adobe Media Core CS6 has stopped working'
    Here are the details:
    Problem signature:
      Problem Event Name:                        APPCRASH
      Application Name:                             Adobe QT32 Server.exe
      Application Version:                           6.0.5.0
      Application Timestamp:                     5211c5c2
      Fault Module Name:                          QuickTimeH264.qtx
      Fault Module Version:                        7.74.80.86
      Fault Module Timestamp:                  5180f338
      Exception Code:                                  c0000005
      Exception Offset:                                001f371d
      OS Version:                                          6.1.7601.2.1.0.256.48
      Locale ID:                                             6153
      Additional Information 1:                  0a9e
      Additional Information 2:                  0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:                  0a9e
      Additional Information 4:                  0a9e372d3b4ad19135b953a78882e789
    I suspect this could be related to Quicktime.
    Any help is much appreciated.
    Thanks
    Ken

    More information needed for someone to help... click these links and provided the requested information
    -http://forums.adobe.com/message/4200840
    -http://forums.adobe.com/thread/416679

  • Using core data with a database

    Here is where I am at. I have a trivia app in development that will have over 1000 questions, so a database is inevitable. We recently created a test sqlite database and read in some entries and it worked.
    We were looking into exploiting the features of Core Data in our app, but this would involve creating a set of managed objects, a context, and the essentials for a Core Data scheme to function, and then use these models to fetch data from a database.
    The database is not created yet. We are starting fresh and simply wish to see if we can use core data to work with a database that could be created once the model is in place. Is it possible to create a 1000 or more entry database whose entries could relate to a Core Data entity or set of entities, and then use Core Data to fetch the data from these entries as we please?

    We will not be reusing any code. I apologize for the confusion. This is the start of the app regarding database management, and we have not yet created the database that will hold the questions for this app.
    Alright, so you two are both suggesting to set up a model and allow the creation of the sqlite store, which if my research is correct, involves a .sqlite file with a "Z_" following each attribute, and then adding entries here. This sounds fair enough. I had not known if this was going against the mainstream use of core data or not.
    Thanks you two. I'm going to leave the question open for a little while longer to see if any other opinions come up.

  • 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.

  • Why has my 3G stopped working on my iphone? It is enabled, and I never had problems with it before, but for about 2 months now it has refused to work and as a result I can't send any attachments such as photos or videos via text.

    Why has my 3G stopped working on my iphone? It is enabled, and I never had problems with it before, but for about 2 months now it has refused to work and as a result I can't send any attachments such as photos or videos via text.

    Cellular data is a feature from your phone carrier.  Have you contacted them to resolve your issue.

  • Derived Values in Core Data

    Using Core Data - I have created a named NSManagedObject that has both a start time and end time.
    I'd like to display a list of these Session and I'd like the SECTION headers to break per day, based on a Session's start date. So, I'm storing a time - and I need to group by a date.
    Would I simply add a readonly property 'startDate' to the literal Session code (.h,.m) that Core Data generated from my data model - in which I would derive the start date from the start time? or would this be a case for declaring a 'transient' property in my Core Data model? I don't exactly know when to use or not to use Transient properties.
    It would be used as follows:
    fetchedResultsController_ =
    [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
    managedObjectContext:managedObjectContext_
    sectionNameKeyPath:@"startDate"
    cacheName:cacheName];
    Will this manually defined property actually work in this method?
    -Luther

    Dear Abir,
    Thanks a lot for your exact reply.
    In tracking tab of UWL what you see is NOT the description given for workflow, it is the Work Item Text for that workflow.
    This is absoltely correct. I inserted the container variables in workitem text from PFTC as you suggested. It worked like a Magic!!!
    KR,
    Bharath

  • Simple core data problem--- please help

    hi all,
    I've done a few core data tutorials, can't say I understand all the switches and doodads, but I'm fairly comfortable with it. I can create almost any kind of "to many" relationship work, and its pure magic...
    the problem is that every "to one" relationship fails to work. I would have thought this was easy! but its apparently impossible.
    heres how to get exactly were i am:
    1. make a new xcode project... core data document based application.
    2. in the model graph make 1 entity with 1 attribute, say an int16 for arguments sake... it doesn't matter what it is the results are always the same.
    3. open up your myDocument.nib file in IB
    4. switch back to xcode, leaving the main window of you Doc visible.
    5. option click + drag your entity from the model graph in xcode, to the main window in IB (you'll see a green plus symbol if its working) and release it
    6. select one object from the resulting option window.
    7. save all files, compile the app, and run it.
    you will now see a control (usually a text box) that is grayed out, and reporting: "no selection". if we had picked "many objects" in #6, this app would be working. so what gives?
    well in the bindings, the item labeled "Controller Key" is set to "selection" and I guess that since there is just the one object, and were already bound to it, theres No need for a selection, thus breaking the binding. But what options do we have in that list? nothing that makes sense, and even though we can put in whatever we feel like, nothing makes any sense. And why would apple even bother letting you drag n drop an entity if it wasn't set up correct in the first place anyway?
    whats going on here? the docs and the tutorials all focus on repeating things I already know, none of them illuminate what the Controller Key is really looking at, and what I need to put in that box to make it aware that it doesn't have a selection, just attributes.

    ok.
    here is whats really happening...
    i set everything up correctly, but when we go to runtime, there is no instantiation of any data, at all. I have a controller, but it has nothing to control.
    with the "to many" relationships, you get an empty table, with add, remove buttons. So its the standard behavior to assume that you don't need the data in the beginning, leading me to a logistical problem, but one that I understand enough to begin formulating a plan.
    I can make a call that instantiates an instance of the data, from my document object, in the awake from nib method. which call? who knows. But I seem to recall that there is some sort of bug in the display anyway, so it may be more complicated than that.

  • Info.plist issues with Core Data

    I created a new project, selecting to use Core Data. However, the info.plist does not include the standard iPhone project options like status bar style and icon gloss etc. I tried copying and pasting the status bar style key and value from another project's plist, but this has no effect.
    Any help would be appreciated please.

    Verduomo wrote:
    I created a new project, selecting to use Core Data. However, the info.plist does not include the standard iPhone project options like status bar style and icon gloss etc.
    Shine is added by Apple now. I get shine without a 'prerendered' key.
    What SDK are you working with?
    Did you add a 'prerendered' key?
    <key>UIPrerenderedIcon</key>
    <true/>

  • 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 Issue

    I am creating a coredata sqlite database file in a mac app (using core data) and am attempting to use the same database and core data model in an ipad app.   I have copied all NSManagedObject files and the .xcdatamodeld directory from the mac app to the ios app.  Even though all files are identical I get "
    The model used to open the store is incompatible with the one used to create the store" when trying to read from the store in the app.  My question is what is actually being compared when this error is thrown?  It looks like it throws the error following SELECT Z_VERSION, Z_UUID, Z_PLIST FROM Z_METADATA.   What is a z_uuid?  Any ideas on how to debug this?   my error dump is below.
    2014-05-06 12:57:29.118 Genome[9055:60b] CoreData: sql: SELECT Z_VERSION, Z_UUID, Z_PLIST FROM Z_METADATA
    2014-05-06 12:57:29.119 Genome[9055:60b] CoreData: annotation: Disconnecting from sqlite database.
    2014-05-06 12:57:29.121 Genome[9055:60b] Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x109527050 {metadata={
        NSPersistenceFrameworkVersion = 481;
        NSStoreModelVersionHashes =     {
            Annotation = <d4eb8bbc 528c6ac9 3cc1decb ca49790e 9933c09b faf47ec9 108fb9b4 b083e144>;
            Band = <14c5dda0 3db4c5c7 27952ce6 5421b597 6d97bed9 b6f225c7 0d956b54 2cfc8282>;
            Gene = <e70a2ed2 fa4c0c3e 1fb8eabc f0f1c26b 9dadb033 0c9198fe 9ba2393e c1a3f9c2>;
            Test = <051b8cd1 849daecf 7a94ac5a 87134d9b 1db8b51c 60bdca34 cb828268 01d6a73a>;
            User = <ebf4a8c8 7209296b 30bdf66c bd7a3dac afa9c8c5 d04f363f 14469686 ba458804>;
            Variant = <58231e33 52687ba7 053846d2 e8d27ed2 58ec690b 2fb09efc 303f299f 2592d6f5>;
        NSStoreModelVersionHashesVersion = 3;
        NSStoreModelVersionIdentifiers =     (
        NSStoreType = SQLite;
        NSStoreUUID = "9B3D312C-95C8-45E3-9F2F-2581E88403A8";
        "_NSAutoVacuumLevel" = 2;
    }, reason=The model used to open the store is incompatible with the one used to create the store}, {
        metadata =     {
            NSPersistenceFrameworkVersion = 481;
            NSStoreModelVersionHashes =         {
                Annotation = <d4eb8bbc 528c6ac9 3cc1decb ca49790e 9933c09b faf47ec9 108fb9b4 b083e144>;
                Band = <14c5dda0 3db4c5c7 27952ce6 5421b597 6d97bed9 b6f225c7 0d956b54 2cfc8282>;
                Gene = <e70a2ed2 fa4c0c3e 1fb8eabc f0f1c26b 9dadb033 0c9198fe 9ba2393e c1a3f9c2>;
                Test = <051b8cd1 849daecf 7a94ac5a 87134d9b 1db8b51c 60bdca34 cb828268 01d6a73a>;
                User = <ebf4a8c8 7209296b 30bdf66c bd7a3dac afa9c8c5 d04f363f 14469686 ba458804>;
                Variant = <58231e33 52687ba7 053846d2 e8d27ed2 58ec690b 2fb09efc 303f299f 2592d6f5>;
            NSStoreModelVersionHashesVersion = 3;
            NSStoreModelVersionIdentifiers =         (
            NSStoreType = SQLite;
            NSStoreUUID = "9B3D312C-95C8-45E3-9F2F-2581E88403A8";
            "_NSAutoVacuumLevel" = 2;
        reason = "The model used to open the store is incompatible with the one used to create the store";

    That is not it.  I acually had it working with Mavaricks and ios7 and then something changed.   I am wondering what exactly is being compared when the The model used to open the store is incompatible with the one used to create the store error is thrown.  It is obviously not the columns of the db and properties of the managed objects because they are identical.

Maybe you are looking for