What is the best way to store (possibly hundreds) of strings in iPhone app? - iphone

There is a possibility that a user of my app may enter tens/hundreds/thousands of pieces of information into the app. For example, they may enter names, addresses, phone numbers of various people.
What would you recommend is the best way to store (a potentially large amount) these strings?
Ideally, I'd like to be able to export the inputted data as a text delimited file or a spreadsheet.

You should consider either CoreData or sqlite. CoreData can be over an xml or sqlite database. If you use sqlite, you should consider the fmdb wrapper on github
But, a lot depends on the access patterns. Sqlite is very fast but it also offers querying capabilities.

Sqlite3 is a great way to store a large amount of data.
http://www.icodeblog.com/2008/08/19/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-1/
Failing that you could always use NSUserDefaults

Related

Best approach to store rich text with images to Core Data?

Is storing NSAttributedText including NSTextAttachment for images, or NSTextStorage into Core Data as binary data a good solution performance-wise?
Do I need to store it as Binary Dataor is there a better alternative? Maybe Transformable? Consider that I need to save it while typing, and this should sync in iCloud with a test editor on iOS.
If not, what would be the best practice to store rich text documents in my app?
thanks
In most cases it is no good practice to store large binary objects in a database. Especially if you write such objects very often (while typing) you stress the database more than necessary. Why not store the data in a file and use the database just for metadata?
With a CloudKit container you can share the files between devices like you already do with the database. Maybe you can the store the NSAttributedText in HTML format, so the files can even be read without your app.

Best way to store data on iphone

I am creating a Questions and answers app for iphone which allows user to answer the questions displayed.
Currently I am invoking a web service to store the users answers. But I am slightly worried what if the web service goes down. I need to store the users answers locally and then invoke the web service when it is up and running.
How can I store the users answers when the web service is down. Is Sqllite a good option for this?
Please suggest.
Thanks,
Is Sqllite a good option for this?
Yes, SQLite is decidedly a good option. The other choice would be Core Data.
Use CoreData or SQLite on iPhone?
It depends on the complexity of your data model. I've looked into something like this recently and here is what I learnt. The most popular data storage methods in the iPhone are:
plist
Good for small quantities (hundreds of Ks) of hierarchical data.
Bad if relationships or queries are complex (since you have to write the code).
Very easy to learn.
Supports array, dict, string, data, date, integer, real, boolean elements.
You can store it as XML, which is editable and portable, or as binary files, which is faster.
Core Data
It's a object graph manager with searching and persistent functionality.
You need a good few hours of learning.
Easy to use once you set it up.
Better than a plist because it lets you manage object graphs, grow your object model, write queries, undo/redo, migrations to modified data models, memory management, and handle concurrent access.
Better than SQLite because:
The performance is similar and the speed of development is faster.
Creating objects is faster.
When the objects are in memory, executing queries doesn't require a search in the backend (which usually is either memory or SQLite).
SQLite
A database.
Better than Core Data when the operation doesn't require you to bring objects to memory. Example: update, delete, and select 1 (see if something exists).
It has full text search if you compile the extension.
Hardest to learn. Easier if you use a wrapper: FMDB, egodatabase.
If you can get away with a plist do that. If you see the amount of code you will have to write is too much work, then switch to Core Data. Only if you are an expert and absolutely need the performance use SQLite (unless, of course, you already know SQLite and not Core Data).
It should be, yes. I'd set up a Core Data based app with entities for Questions and Answers and set up relationships between them. Then just use NSFetchedResultsController or whatever you would like to gather and display the data
You have several options:
Sqlite
Core Data
Client-Side storage
If you wish to go the web based route, I'd take a quick look at Safari Client-Side Storage and Offline Applications Programming Guide.
Basically, you store a local copy of the database in memory so incase the web service is down, users can still use the app.

is sqlite is better or plist is better to save and edit items

i am trying to develop a simple application like shopping list.
for that i have 20 categories in that 250 item names.
for that i found two ways to save these item names and it's respective values one is using sqlite data base,another one is plist.
and i need to edit these item quantity and need to add new item to category.
for that which way is better for my application.
experts who have familiar with sqlite data base and plist can suggest which way is better.
thank u in advance.
My feeling is that SQLite is the better tool for this job, especially when the data grows. That's because with a PList, you have to completely load it into memory whereas with SQLite you only fetch the data you need. Of course, programming for SQLite is a little bit more work but if you encapsulate that in a class it can be as easy to use later on.
Using of SQLite would be suggested.
If you are doing more transaction over the database then use SQLite instead of plits.
If it is client- server modal, have a database of SQL or Oracle at the back end. Store the data which is frequently used at the client side using SQLite ans sync it regularly with the database
regarding sqlite tutorial
http://dblog.com.au/iphone-development-tutorials/iphone-sdk-tutorial-reading-data-from-a-sqlite-database/

Data storage format for iPad app. Export to excel

I am fairly new to Objective C and iOS programming but am constantly trying to learn as much as I can.
I am about to start an iPad project which will involve storing large amounts of data which will need to be exported to one extremely large excel spreadsheet.(it's for a friend....they currently enter massive amounts of data into excel by hand so that they can analyze it).
This database contains over 400 names(this number is constantly growing) and the app will be very functionally similar to to built in contacts app, except that for each name there will be approximately 2,000 attributes. These attributes will be entered across tens, if not over a hundred views.
The excel file will be located on a local server and the database will be synced with it over wifi. If I have to write a server side application to handle this, I happily will.
My question is this:
What data storage method would serve best for my purpose accounting for the sheer size of the database and the need to export to excel? (i.e. CoreData?, SQLLite?, XML?)
I sincerely appreciate any help you might offer.
James
It'll be harder to create a CoreData store on the server end. I'd suggest using and SQLite DB. FMDB is decent frontend for using SQLite on the iPhone, but there are many others.
A framework for relational data such as Core Data or SQlite would work well for selecting and working with subsets of data. There's no innate export-to-Excel functionality but you could export a csv (comma-separated-value) file that Excel can import.

How to use local dictionary to my app?

In My application, how should i find meaning of the word, it should work both online and offline? Please help me out also is there any possiblilite to take local dictionary from iphone?
Sri
As far as I am currently aware, you aren't able to query the iPhone's built in dictionary.
Even if you could, I am not sure that it contains any definitions. Rather it looks for spelling correction on "close" words.
If you are wanting to replicate storing a dictionary inside your app, like the many dictionary apps currently out there, you would have to store the data in your iPhone app somehow.
Wikitionary provides free "dumps" of it's data which you could grab, and put into a form that would be usable in your app.
You would need to store the data in some form of plist, an SQLite database or CoreData.
For taking data from the internet, you would need to look at transferring the data using JSON, XML or PLIST.