0

I am new to iOS programming and looking for advise for an iPhone app that I am creating.

I have an excel database of about 100 daily tips (which will continue to grow) that I want to import into the app, and have one tip display each day. The user will have access to the current daily tip, plus any prior tips from prior days in the database.

I would like to keep it as a closed app, so if a user feels they want to skip ahead to see new tips by changing their current date - I am not worried about the few who might do that.

From my searches so far, CoreData seems to be the way to go but I was looking for suggestions.

Any help is greatly appreciated.

BradG
  • 41
  • 1
  • 2
  • 8
  • What is your question? Do you want to know how to import the database, or how to only show ones with a date <= today? – jrturton Jun 06 '12 at 15:22

1 Answers1

2

I'll try to give you some advice to achieve what you want.

First of all, what do you mean with

I would like to keep it as a closed app, so if a user feels they want to skip ahead to see new tips by changing their current date - I am not worried about the few who might do that.

I'm not sure about its meaning.

Said this, based on my experience (someone else could give you other advice) I suggest you the following.

About your model you need to create an entity, say Tip, that could have the following attributes:

  • guid: an identifier that works as an identifier, the type could be a NSString

  • creation date: the creation date for your tip, the type is a NSDate

  • text to present: the text to present to the user, the type is a NSString

In addition you can also set a title, etc.

The date has two objectives.

First, it allows you to filter tips based on the current date. To filter you need to create a NSFetchRequest and set a NSPredicate. For example:

[NSPredicate perdicateWithFormat:@"creationDate <= %@", currentDate];

In addition it allows to sync with your service to download data. Based on the max date you find in the core data sql lite file, you could ask a service (if you use one) to give you the tips that are greater than that date.

The guid allows to have only one tip for that identifier (you could just use the date for that but I think is easier to have a guid, say 12345). This could be useful if you decide to download each time the whole data and you don't want to insert the same tips. In addition, you don't want to ricreate the db when you have new tips, but you would add only the new ones. So, you need an identifier that let you to verify if a tip is already there.

Finally, about your service (if you want to set up one) you could download data in JSON format. I think it's simply to set up.

If you are interested, here some links that could make your life easier:

If you want to know something else, let me know.

Hope it helps.

Community
  • 1
  • 1
Lorenzo B
  • 33,216
  • 24
  • 116
  • 190
  • Sorry about the confusion, I am still learning. By closed I meant to be contained in the app (not using a server). It seems like that is the solution you are providing (again, unless I am misunderstanding something). Thank you for the info and extra links. I am going to use this and work my way through it. I will get back to you on how it works out - though it may take a little time until I grasp it all. Thanks again! – BradG Jun 07 '12 at 15:12
  • @BradG You're welcome. A simple question. Can your tips update or not? For example, do you have only 365 tips or is it possible they can grow? Did you think about a mechanism to update the tips? – Lorenzo B Jun 07 '12 at 15:54
  • I plan on having an initial amount of say 100, but I will be adding more when I have updates for the app. So the database will be continually growing. – BradG Jun 07 '12 at 16:47
  • @BradG I expanded a little bit my answer. Hope it helps. – Lorenzo B Jun 07 '12 at 17:21