Re: Populating a new SQLite Core Data store with default data

2009-02-26 Thread Sean McBride
On 2/25/09 11:29 PM, Ben Trumbull said: >The ObjC property notation is more of a stickler. You can type cast >to a specific subclass. Xcode's Design -> Data Model -> Copy ObjC 2.0 >Method Declarations to Clipboard will do all the heavy lifting if you >add new properties to your entity. Just sel

Re: Populating a new SQLite Core Data store with default data

2009-02-26 Thread I. Savant
On Thu, Feb 26, 2009 at 9:02 AM, Jon C. Munson II wrote: > Interestingly enough, as I wanted my objects inserted in a particular order, > I had to call save after each insertion (no big deal as I don't have that > many records and this is a one-time thing) - the MOC didn't save the records > in t

RE: Populating a new SQLite Core Data store with default data

2009-02-26 Thread Jon C. Munson II
> -Original Message- > From: cocoa-dev-bounces+jmunson=his@lists.apple.com [mailto:cocoa-dev- > bounces+jmunson=his@lists.apple.com] On Behalf Of Ben Trumbull > Sent: Thursday, February 26, 2009 2:30 AM > To: Cocoa Developers > Subject: RE: Populating a new SQLi

RE: Populating a new SQLite Core Data store with default data

2009-02-25 Thread Ben Trumbull
After some brief testing, if one creates entities of NSManagedObject thus: NSManagedObject *someObject = [NSEntityDescription insert...]; one most likely cannot use the dot syntax accessors as someObject, during compilation, has no idea of the attributes of that object an thus an

RE: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
> > > > // generic > > NSManagedObject someObject = [NSEntityDescription insert...]; > > (anEntity *)someObject.attribute = @"somevalue"; > > Same here, I don't know if this must be seen as a bug or not. This > works for me : > > ((anEntity *)someObject).attribute = @"somevalue"; > >

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread I. Savant
On Mon, Feb 23, 2009 at 3:50 PM, Jon C. Munson II wrote: > I could not, however get this to work (and it may not be possible) with the > appropriate @class & #import: >(anEntity *)someObject.attribute = @"somevalue"; You really need to be specific here - I suspect that's one of the re

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Frédéric Testuz
Le 23 févr. 09 à 21:50, Jon C. Munson II a écrit : I meant: [(MyClassyClass *)obj doSomethingSpecificToMyClassyClass] The cast needs to be applied to the pointer - obj - and not to the returned value (outside the [ ] square brackets). -- I.S. [Jon C. Munson II] That made a difference.

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Wim Lewis
On Feb 23, 2009, at 12:50 PM, Jon C. Munson II wrote: I could not, however get this to work (and it may not be possible) with the appropriate @class & #import: (anEntity *)someObject.attribute = @"somevalue"; Is there a way to implement that methodology as well? I believe the prob

RE: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
> > I meant: > > [(MyClassyClass *)obj doSomethingSpecificToMyClassyClass] > > The cast needs to be applied to the pointer - obj - and not to the > returned value (outside the [ ] square brackets). > > -- > I.S. [Jon C. Munson II] That made a difference. I took your literal word originall

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread I. Savant
On Mon, Feb 23, 2009 at 2:44 PM, Jon C. Munson II wrote: > Ahh, I see...I did think that's what he meant, but I needed further > clarification. > > I'll give that a shot... Well, while you're giving it a shot, keep in mind I made an error here: >> (MyClassyClass *)[obj doSomethingSpecificToMyC

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread mmalc Crawford
On Feb 23, 2009, at 11:43 AM, Jon C. Munson II wrote: On Feb 23, 2009, at 11:09 AM, Jon C. Munson II wrote: Feel free to show me the correct way as I don't see it in the dox.

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Quincey Morris
On Feb 23, 2009, at 11:09, Jon C. Munson II wrote: [Jon C. Munson II] Here's what I tried: NSManagedObject *someObject = [NSEntityDescription insert...]; someObject.attribute = @""; and also: NSManagedObject *someObject = [NSEntityDescription insert...]; [someO

RE: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
, 2009 2:29 PM > To: jmun...@his.com > Cc: Cocoa List > Subject: Re: Populating a new SQLite Core Data store with default data > > On 2/23/09, Jon C. Munson II wrote: > > > Kyle mentioned something about casting. While I know what certain > casting > > is, (int)i f

RE: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
> > On Feb 23, 2009, at 11:09 AM, Jon C. Munson II wrote: > > Feel free to show me the correct way as I don't see it in the dox. > > > es/cdUsingMOs.html > > > [Jon C. Munson II] Again, feel free to show me the corre

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread I. Savant
On Mon, Feb 23, 2009 at 2:28 PM, I. Savant wrote: > This isn't even Objective-C; it's just a pointer: Sorry, I was trying to be brief as I was responding from an iPhone. :-) What I meant was, it's not even *a matter of* Objective-C syntax. The pointer to your managed object subclass instance i

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread mmalc Crawford
On Feb 23, 2009, at 11:09 AM, Jon C. Munson II wrote: Feel free to show me the correct way as I don't see it in the dox. mmalc ___ Cocoa-dev mailing li

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread I. Savant
On 2/23/09, Jon C. Munson II wrote: > Kyle mentioned something about casting. While I know what certain casting > is, (int)i for example, I'm not sure what he meant. If he meant to include > the class header file and stipulate the class up front, etc., then I hadn't > done that as, again, the s

RE: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
> > After some brief testing, if one creates entities of NSManagedObject > > thus: > > NSManagedObject *someObject = [NSEntityDescription insert...]; > > one most likely cannot use the dot syntax accessors [...] > > > This is not the case if you follow the patterns described in the > document

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread mmalc Crawford
On Feb 23, 2009, at 10:35 AM, Jon C. Munson II wrote: After some brief testing, if one creates entities of NSManagedObject thus: NSManagedObject *someObject = [NSEntityDescription insert...]; one most likely cannot use the dot syntax accessors [...] This is not the case if you follo

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2009 at 1:35 PM, Jon C. Munson II wrote: > You'll have to use KVC in that case. At least, I did. I tried both the dot > and standard accessor to be sure. You can usually cast the result yourself, since typically the entityName argument for +[NSEntityDescription insertNewObjectFo

RE: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
> > > > > By calling -setValue:forKey: one can then fill in the data values > > for the required > > attributes. > > > The documentation makes clear that you should typically *not* use key- > value coding to set managed objects' attribute values: >

Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread mmalc Crawford
On Feb 23, 2009, at 6:37 AM, Jon C. Munson II wrote: When the -insert method is called, Core Data creates an instance of a new object for an entity and returns a pointer to that object. [...] This is described in the documentation:

RE: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
For anyone following along, the following answers the question I had regarding adding "records" to a "table" using Core Data: > Thus (psuedo coded for brevity): > > someObject = [NSEntityDescription insertNewObjectForEntityForName:object inManagedObjectContext:moc]; > [someObject setValue:@"val" f

RE: Populating a new SQLite Core Data store with default data

2009-02-20 Thread Jon C. Munson II
> In the documentation. [Jon C. Munson II] The documentation I read through, which includes the prior link + the API reference + a couple samples on the various class methods weren't enough to answer my questions. So, my OP stands and remains unanswered. _

Re: Populating a new SQLite Core Data store with default data

2009-02-20 Thread mmalc Crawford
On Feb 20, 2009, at 12:10 PM, Jon C. Munson II wrote: Additionally, the section on Creating and Deleting Managed Objects isn't specific enough in my case to support my theories. What "theories"? Why do you need theories? Second question: how to actually add records? In the docuentatio

RE: Populating a new SQLite Core Data store with default data

2009-02-20 Thread Jon C. Munson II
> All your questions are answered in the documentation. [Jon C. Munson II] No, they aren't. The specific questions relative to the specific methods are generally answered in the documentation (which I consulted before I posted originally). Additionally, the section on Creating and Deleting Manag

Re: Populating a new SQLite Core Data store with default data

2009-02-20 Thread mmalc Crawford
On Feb 20, 2009, at 9:38 AM, Jon C. Munson II wrote: Also, I saw something about sending that -save message, but can't remember where I found that - is that necessary as well? If it is, it ought to be part of the dox for the insertNewObject... since it is a necessary piece of the pie.