• 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: core data and sqlite db store problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: core data and sqlite db store problem


  • Subject: Re: core data and sqlite db store problem
  • From: Jeff LaMarche <email@hidden>
  • Date: Mon, 31 Mar 2008 12:51:47 -0400

Core data stores metadata as well as data in the sqlite3 file and follows a very specific naming convention for the regular data tables and columns. You'd probably be better off writing a small migration utility to import the data you need than to try create a sqlite3 database in the right format. Also, if you use this mechanism, when you distribute your app, none of that data will go with it.

Why don't you move out your sqlite3 file and let it create a new one, then go in and look at the tables and structure, and you'll get an idea of what I'm talking about.

HTH
Jeff
On Mar 31, 2008, at 12:45 PM, Scott Guyer wrote:

Hi,

I'm just learning core data and have already stumbled on something. I created a CD application using the XCode template. I've created a sqlite3 .db file with data and a matching core data model in xcode. My code fails here...

url = [NSURL fileURLWithPath: [applicationSupportFolder stringByAppendingPathComponent: @"my.db"]];
persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]];
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:nil error:&error]){
[[NSApplication sharedApplication] presentError:error];
}


with an error saying that the db file cannot be opened because it is not in the right format. "The file might be corrupted, truncated, or in a different format than you expect." That's quite odd to me, since I can interact with that db file on the command line using sqlite3 just fine. Anyone have any ideas/suggestions?

Much appreciated!

_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: core data and sqlite db store problem
      • From: Scott Guyer <email@hidden>
References: 
 >core data and sqlite db store problem (From: Scott Guyer <email@hidden>)

  • Prev by Date: Re: Main Thread UI and Detached Thread
  • Next by Date: Re: Movable by window background AND custom NSView
  • Previous by thread: core data and sqlite db store problem
  • Next by thread: Re: core data and sqlite db store problem
  • Index(es):
    • Date
    • Thread