Re: NSPopupButton with NSArrayController
Re: NSPopupButton with NSArrayController
- Subject: Re: NSPopupButton with NSArrayController
- From: Ferhat Ayaz <email@hidden>
- Date: Sun, 7 Jan 2007 04:28:37 +0100
I want to give my special thanks to you and apologize for lack of
information about the problem. I solved it in almost the same way as
you explained. But yours is better. We have 4:27 at the morning now :)
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Invoice" inManagedObjectContext:moc];
NSString *className = [entity managedObjectClassName];
Class entityClass = NSClassFromString(className);
NSManagedObject *invoice = [[entityClass alloc]
initWithEntity:entity
insertIntoManagedObjectContext:moc];
On Jan 7, 2007, at 4:14 AM, I. Savant wrote:
On Jan 6, 2007, at 7:04 PM, Ferhat Ayaz wrote:
I know this document. It doesn't work for me. I want to use the
add: method of an NSArrayController. This is very important.
Please don't refer to the same docs again. I read this more then
one time. Or you can write how it can work.
Any AppKit tasks (refreshing TableViews etc.) are performed
"after" method -makeInvoice.
This is *new information* you have *not mentioned* at all
previously. You can't expect an accurate answer by leaving out
"very important" details. I'm trying my hardest to help you, but
it's rather impossible at this rate.
You say, "Any AppKit tasks (refreshing TableViews etc.) are
performed "after" method -makeInvoice.".
Okay ... so what's wrong with that? Why is that bad? How is that
relevant? We don't know exactly what you're trying to do or how
you're going about it because you haven't explained that. How can
you expect anyone to tell you how to fix the situation then?
What is needed is:
1 - What, in the plainest language you can muster, are you trying
to do? (a full explanation is best)
2 - How exactly did you try to create an NSManagedObject instance
and add it to your context? (exact code, please)
3 - What went wrong? (were there errors? was there unexpected
behavior? would you care to share this information?)
4 - What did you expect to happen? (this is important so we can
identify with your reasoning and more easily point you in the right
direction)
Questions 1, 2, and 3 are required if you're following the
documentation and getting unexpected results. Question 4 will help
us to point out what you might be missing (and we can assume you're
missing something since others are doing things just fine).
Creating an instance of one of your entities is generally as easy
as the docs make it look:
NSManagedObject *newEmployee = [NSEntityDescription
insertNewObjectForEntityForName:@"Employee"
inManagedObjectContext:context];
Once this is done, newEmployee should point to your shiny new
"Employee" instance. If it does not (if it's nil), you can assume
an error. If you've done it this way and there was a problem,
specify it. Without that information, nothing you're telling us
makes sense.
--
I.S.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden