core data, opening a previously saved xml file... bug/glitch/unexpected behavior

2009-04-02 Thread eblugamma

hi,
	this SHOULD be automatic, if its a bug I'm guessing its WELL  
documented, but no matter how well I search, I can't get ANY hits on  
this. my application is Not Properly Loading my saved Core Data files.


I have a very simple Core data App.
it has 3 entities, two of them have relationships to the third.
category,
receipt,
and record.
as you can imagine, each record has both a receipt and a category  
relationship, so that I can view my data along 2 axes.


the interface works great. everything works, adding new entities on  
all levels, removing them, and changing their attributes.


but when I save the file, close it and re-open it... it appears to be  
empty.
I've opened the file in a text editor, its NOT empty. I've had a good  
look at the file after consecutive opens coupled with changes and then  
saves.
the Objects Are Loaded, and forwarded to the next save, but my  
arrayControllers IGNORE THEM


I thought that the array controllers might need to be set with a  
filter predicate of either:

isRoot == YES, or
parent == nil

but those both have ZERO effect on this behavior. (and I can't find  
the original references for those tricks)
anybody Know what is going on here?  very similar apps I have built  
work without ANY FUSS in this area whatsoever.


thnks,
-eblu

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


strange NSUndoManager + KVC inconsistency.

2009-02-03 Thread eblugamma

Hi List,
please help.
I have a doc based project with a class that stores all of its  
properties in a Mutable dictionary called : store.

this Class has wrapper methods for valueForKey: and setValue:forKey:
its been working great ! ui elements bind to it, you don't need to  
declare the properties ahead of time, and you don't have to mention  
the dictionary "store" in the key path, the properties are treated as  
if they are of my Object.  its elegant, clean, and easy to work with.


and then I tried to add Undo support. undo refuses to accept that my  
class is Key Value Coding compliant, for ANY keys in my dictionary,  
populated or not.  Now, remember... my UI works with this class...  
array controllers, text fields, tables, everything. its only when I  
try to add

this:
[[undoManager prepareWithInvocationTarget:[self store]]  
setValue:randomObj forKey:key];

during the setValue:forKey:  wrapper method, that I have trouble.

heres what the trouble says:
Error setting value for key path title of object   
(from bound object (null)): [0x1064910> setValue:forUndefinedKey:]: this class is not key value  
coding-compliant for the key title.


I have, with relative ease, been able to get NSUndoManager to behave  
with objects that have standard properties... (@property  
(readwrite,retain) blah blah...) so I know my way around the  
undoManager basics. But undoManager doesn't think my valueForKey: and  
setValue:forKey: constitute KVC compliance, but I beg to differ. the  
documentation CLEARLY STATES:
The method for getting an object’s value is valueForKey:, which  
returns the value for the property identified by the specified key.  
The method setValue:forKey: sets the value of the property identified  
by the specified key.

...right in the definition of KVC.
I know NSDictionary Overrides the setValue and valueForKey methods  
that NSObject declares, so what gives? Thats all I am doing...  
UndoManager should NOT be giving me a headache, as far as I know.
anybody run into this? anybody have an ideas? I'm thinking about Just  
adding a category to NSMutableDictionary, but that seems so inelegant  
for such a straightforward design problem.

thnx,
-ted

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


coreData+bindings+IB challenge.

2009-01-30 Thread eblugamma

hey guys,
got a coreData+Bindings+IB challenge that I just can't figure out.   
The apple docs and the obligatory search of the various channels of  
dev data has yielded zip.


so to boil it down to a clear and simple as it can be...

I have 2 entities : entA and entB.
entA has a to-many relationship to entB, called: entBRelationship.  
(with appropriate inverse)

entB has a numerical attribute named: "order"

I have a master detail interface, works great. it consists of :
a tableview bound to an arrayController in turn bound to entA entities.
a tableView bound to an arrayController in turn bound to the  
entBRelationship of the Selection of entA's list.


like I said: works great.
heres what doesn't work, what I can't find any documentation that even  
hints at how to do it, or any reference anywhere that even talks about  
trying something remotely like this:
I have a text field. I want to bind it in IB, to the entB  whose order  
== 1, of the EntBRelationship, of the selected entA.


that sounds like I should have an ObjectController with a filter  
predicate (@"order == 1")bound to the same arrayController that my  
second tableView is bound to.
that "SHOULD" fetch the singular object in the array that fits the  
fetch predicate.
bzzzt. nope, doesn't work. it returns a set. (in an OBJECT  
CONTROLLER?)


or an arrayController, with a filter predicate... nope, another NSSet  
is returned.


I subclassed NSArrayController and added a method of "object:" to it  
which returns the object of index:0 of the arranged objects, and then  
bound the text field to THAT, but guess what happened there? the KVC  
was messed up, my text field never updated, even though it allowed me  
to change the value of the object.  unnacceptable, and not really  
helpful. I need to be able IN IB to set the search predicate.


can anyone shed some light on how to use IB, to bind to a singular  
ManagedObject based upon a predicate?


can anyone shed any light on the fact that ObjectControllers appear to  
have No utility whatsoever, because they cannot be bound to objects in  
an arrayController's arrangedObjects array?


can anyone tell me why IB drops the inspector for the selected  
controller when I apply bindings?  its a bug, its unavoidable, it  
SEEMS like it would be trivial to fix compared to most bugs, and its  
been around for over a year!


peace,
-td



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


core data + bindings + custom view ?

2008-11-13 Thread eblugamma

heres a little more detail:
I have an NSControl subclass that maintains a list of cells, and an  
NSMutableArray called "content". I have
successfully bound its "content" to the core data based array  
controller's "arrangedObjects" array. I thought that was all I needed  
to do to get bindings working, so I made my  setContent: accessor  
method so that it kept my cell list updated with the content list...  
this did not work.  my setContent accessor was called once, during the  
initialization phase of the app.


next, I tried registering for KVO on the array controller's  
"arrangedObjects" value, thinking that... since it is an array, it IS  
a "to many" relationship, and I would not only get alerts to changes  
to the array, but also information about the changes, in the change  
dictionary under the "NSKeyValueChangeKindKey" key.  This sort of  
worked. I get a notification when the ArrangedObjects is altered, but  
the information about the change is NOT in evidence. Apparently, this  
is not a "to many" relationship after all?  (ummm... what??!!?!?  is  
this true?) And isn't this KVO a little redundant anyway? doesn't  
bindings do this already? isn't there some way for me to automatically  
get notified BECAUSE "content" is bound to the array controller?  
(which is what I was trying to do with the setContent: method)


currently, I am thinking that I will have to discover the changes  
myself, by comparing my content against my cells. it seems a bit  
redundant (read: wasteful), but that seems to be the order of the  
day... do everything twice.


so in all of this, i am frantically looking for ANY documentation that  
explains how to duplicate any part of something I see and use every  
day... namely the smooth interaction between a custom UI element (that  
works SORT of like a tableview, in that it displays a list of things)  
and an array controller that happens to use core data for its  
content.  The official apple docs, are... anemic at best, and my  
google searches have come up empty.


it seems from my worm's eye view, that what I am trying to accomplish  
SHOULD not be this difficult, nor this kludgey, I really feel like I  
am missing something important, but try as I might, the documentation  
falls extremely short of being helpful.


thanks guys,
-eblu
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


garbage collection and NSConnection

2008-06-30 Thread eblugamma

hey,
I have a project that uses Bonjour for some of its communication,  
theres a server and a client, and I was having tremendous difficulty  
getting it to work, pouring and pouring over my code, only to discover  
some weeks later that for some odd reason, NSConnections do not work  
when the project is set to support or require garbage collection.


As a test I set garbage collection to: Unsupported, and the app  
compiled, and the NSConnection returned the proxy object as expected.   
But the app obviously failed to do much else, because I had no retain,  
release, or autorelease method calls.


I am not a lazy person, but I am a novice programmer, and the retain,  
release, autorelease stuff in cocoa is horrible. I was very happy when  
garbage collection was added to Cocoa, and my projects became much  
easier to develop, and maintain. Now however, I find myself with a  
project riddled with memory problems that did Not exist just a few  
days ago, and as far as I can tell, I don't have any choice... My app  
either gives up Bonjour, or I have to retrofit the whole thing to  
manage its own memory with a system that is, lets face it, poorly  
envisioned.


can anybody shed any light on this? am I really stuck managing the  
memory myself? This is intolerable.


cheers,
-eblu
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


re: NSTreeController Core Data Duplicate Entries Problem

2008-04-10 Thread eblugamma

Hi Chris,
I think I have a solution for you. I've been having the same exact  
problem as you, and while looking for the solution, I stumbled upon  
your post.
then I stumbled upon the solution. I don't have a clear picture of  
whats happening, but your duplicate entry problem centers on the  
prepares content option in the tree controller in IB.


turn it off.

thats right, turning off the prepares content option in IB fixes the  
duplicate entries problem.
Now for you... that might cause some other problem, but I can assure  
you that my model object is very similar to yours and mine works now.




From: Chris Schmitt
Subject: NSTreeController Core Data Duplicate Entries Problem
To: cocoa-dev@lists.apple.com
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

I have a simple core data application set up with 1 entity for
tracking folders.  This entity has a circular reference to itself to
mark the Children and Parent objects.   I then added an
NSTreeController to a simple form and hooked it up to an
NSOutlineView.  After hooking up the bindings and a add and delete
button I can add records to the tree controller and the display works
fine.

My problem is, when I reopen the application the data was not being
loaded into the NSTreeControl, so checked the prepares content button
and my data showed up.  Now when I add a new child entity to one of my
existing entities I get a duplicate parent created.

Example:
Folder 1
  Child 1
Folder 2

When I add a Child 1 to Folder 1 I get the following:

Folder 1
  Child 1
Folder 2
  Child 1
Folder 3

The child record is being created, but a new parent record (Folder 3)
is also being created.  The add button is hooked up to the addChild:
method on the NSTreeController.

How do I stop this duplicate entry problem?

Thanks in advance.
Chris Schmitt

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]