Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Professional iPhone and iPad Database Application Programming
|
BOOK: Professional iPhone and iPad Database Application Programming
This is the forum to discuss the Wrox book Professional iPhone and iPad Database Application Programming by Patrick Alessi; ISBN: 978-0-470-63617-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional iPhone and iPad Database Application Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2011, 07:49 PM
Authorized User
 
Join Date: May 2011
Posts: 19
Thanks: 9
Thanked 0 Times in 0 Posts
Default Pre-populating dbase in Core Data app - not covered in book?

After a tough go of it, I finally made it through Chapter 7 (possible only due to generous help from 'pianoguy'/Bob) and through the end of the section dealing with Core Data. One thing was unfortunately missing from this section and - from looking ahead - I'm afraid it won't get covered at all in the book. That is, how does one get existing data (data *not* supplied by users) into a database when Core Data is used? The beginning part of the book covered getting the data into a SQLite dbase, but Core Data was not used for those examples.

Does anyone know of a good tutorial or other resource (preferably other than or in addition to Apple) for getting (a lot of) data into a SQLite database in an app that uses Core Data? I'm looking specifically for how to populate the database before it is sent to the App Store.

Thanks in advance for any help.
 
Old June 24th, 2011, 07:56 AM
Friend of Wrox
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

See if this helps.
http://www.raywenderlich.com/980/cor...-existing-data
(This article is part 2 of a three part series. I haven't gone through it, but the discussion and response in the comments section seems quite positive.)

Bob
The Following User Says Thank You to thepianoguy For This Useful Post:
tecky10 (June 24th, 2011)
 
Old June 24th, 2011, 03:29 PM
Authorized User
 
Join Date: May 2011
Posts: 19
Thanks: 9
Thanked 0 Times in 0 Posts
Default Importing data... Core Data/SQLite

Thanks, I had seen that one, but was concerned because it uses a Python script (something I'm not familiar with) and says "Note that by using a Python script to import the data rather than working with a utility app that uses Core Data APIs, it’s more likely to break in the future because we’re kind of going under the hood here"

The app is basically like a dictionary. It will need to come pre-populated… no edits or changes are allowed. I can get the data arranged into all sorts of formats (including SQLite), but I can't determine how to get the data from any of these formats into the app so that I can take advantage of Core Data. I've seen some 'hacking' methods online, but they are not recommended by Apple and may not work in the future. I think I must be missing something because it seems hard to believe there's no reliable/approved way to pre-populate a database when Core Data is used.

It's beginning to seem that my best bet is to forget Core Data all together and just use SQLite directly. However, I read that Apple may not like this approach…and they have apparently taken related materials off their site that covered this.

Is it really possible that something that seems this basic is not doable (at least without 'hacking') when Core Data is used?

And, is it really such a bad idea to *not* use Core Data…especially when adds/changes to the underlying database are not allowed?

I'd appreciate any suggestions, comments, ideas…

Thanks much!
 
Old June 25th, 2011, 08:33 AM
Friend of Wrox
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

The information in the documentation for importing data does not suggest a means to get your data into the project?

Bob
 
Old June 25th, 2011, 01:14 PM
Authorized User
 
Join Date: May 2011
Posts: 19
Thanks: 9
Thanked 0 Times in 0 Posts
Default Re: Importing data / Core Data

Unfortunately, not as far as I can see. The documentation in the book does not cover this (importing into a SQLite dbase is covered...but importing into a database created by Core Data is not...and apparently you aren't supposed to directly access the database created by Core Data as you would a regular SQLite dbase). For Apple documentation, there is an article on their site concerning importing data (see link below), but I don't understand how this would work to pre-populate the database before shipping.

http://developer.apple.com/library/m...Importing.html

I find the above article confusing, but others more knowledgeable than myself - including the author of the article you mentioned previously - apparently have not found a direct way to import these records. I even saw a couple of posts advising that this be suggested to Apple as a feature. Of the methods I did find online, typically they are a work around / 'hack' that may break in the future. However, I was hoping for something that was recommended by Apple and would (hopefully) not break in the future.

At this point, I'm thinking that I won't be able to use Core Data. Unfortunately, though, this doesn't seem like the right approach. Nevertheless, I need these records actually imported into the database...so if Core Data cannot do this in a safe manner, I don't see what other options I have.

Any advice would be appreciated.

Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 Task - Core Data setup won't run mfromin BOOK: Professional iPhone and iPad Database Application Programming 1 April 24th, 2011 07:34 PM
data entry pre-fix value mateenmohd Access 5 February 17th, 2008 07:52 AM
SQL Server: Copy Table From dbase to other dbase orez SQL Server 2000 3 July 7th, 2004 03:51 AM
Retrieving data direct from dbase?? junemo MySQL 16 June 16th, 2004 02:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.