• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using Core Data in Command Line utility
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Core Data in Command Line utility


  • Subject: Re: Using Core Data in Command Line utility
  • From: Paul Johnson <email@hidden>
  • Date: Mon, 8 Mar 2010 20:35:33 -0600

Thanks for the quick reply, Roland. That's exactly what I needed to
solve the problem.

A couple of side questions:
1. Another way to archive the data is to use "dataOfType:error:" and I
wonder if one way is preferable over the other.
2. I use the save: method to write the data and there are two files
created: a .mom file that describes the data model and an sqlite file
containing the actual data. Another program is going to read the data
file and I'm assuming only the sqlite file needs to be read (and the
.mom file just ignored). To read the data I plan to use
readFromData:ofType:error:. Instead of the save: method when would one
archive the data using dataOfType:error:?

On Mon, Mar 8, 2010 at 7:48 PM, Roland King <email@hidden> wrote:
>
>
> Paul Johnson wrote:
>>
>> In the innermost scanner loop, I am trying to use
>> NSEntityDescription
>> insertNewObjectForEntityForName:inManagedObjectContext, to create an
>> NSManagedObject which I then want to populate with the two strings and
>> the integer using [object setValue:forKey:]
>>
>> The problem I'm having is the line that tries to store the integer:
>> [object setValue:i forKey:@"fileIndex"];
>>
>> I get the compiler error "Passing argument 1 of 'setValue"forKey'
>> makes pointer from integer without a cast".
>>
>> Can anyone tell me how to fix this? I'm also wondering if I'm using
>> the correct methods to accomplish the task.
>> _______________________________________________
>
> setValue:forKey takes an id (NSObject*) not an integer. You need to wrap
> your integer into an NSNumber, [ NSNumber numberWithInt:i ] and set that.
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Using Core Data in Command Line utility (From: Paul Johnson <email@hidden>)
 >Re: Using Core Data in Command Line utility (From: Roland King <email@hidden>)

  • Prev by Date: Re: Objective-C Garbage Collection problems
  • Next by Date: Re: NSApp question
  • Previous by thread: Re: Using Core Data in Command Line utility
  • Next by thread: Re: Using Core Data in Command Line utility
  • Index(es):
    • Date
    • Thread