SQL-lite efficiency - iphone

I want to store my map data in the sql-lite database on iPhone. I want to use the "NSUserDefaults" class for this. What do you think? It will be efficient to ask the database manager to load the map everytime I need it? And how big map can I store there? Is there any limitations?
Thank you for the answers!

NSUserDefaults should really only be used to store settings and not as a general data store. It's not a sqlite database. For storing your map data you could use Core Data.

Related

What is exactly "a large set of data" to decide whether to use NSUserDefaults or CoreData?

I'm storing just one NSArray to NSUserDefaults, but this array may eventually have many objects inside.
Could it be a problem using NSUserDefaults?
I would say use Core Data just because you want to simplify your life when dealing with anything more than a hundred data objects within two or more categories or "entities".
Using Core Data means that you're not dumping the entire data set into memory when you load it. Instead, you're using what are called faults which fire when necessary to load additional relationships and associated data.
Migrating the data is also another big benefit of Core Data. When you need to change the data structure, you just create a simple migration and it's done automatically for you. If instead you had an NSArray or NSDictionary in the user defaults, you'd have to iterate over the entire thing and try to change the data structure or migrate an old key name to a new key name. Not an easy task.
Another benefit of Core Data is that it works seamlessly with UITableView and UICollectionView to intelligently search and load only relevant items within your data set which helps improve overall app performance. This is all done via NSFetchedResultsController.
Working with one type of NSArray such as People that only has a hundred people in it shouldn't be a big deal and you can use NSUserDefaults for that as long as the People array doesn't have a lot of associated data stored within it.
Honestly, every app I create that needs any kind of data storage other than basic user preferences uses Core Data now. I don't waste my time on Property Lists or user defaults anymore and I would recommend you not to either.
NSUserDefaults is named as it is for a reason. It's designed to store a handful of user preferences and settings for your app, not the bulk of its data. If you're storing anything that resembles a database, NSUserDefaults is not the way to implement it -- use Core Data, as per #iWasRobbed's answer.
NSUserDefaults only use to store limited amount of data.if you have large amount of data you should go with coreData.

Storing User Data iOS

i'm developing an iPhone app for the first time. I know that username and password commonly stored in KeyChain. How about data like FirstName, ProfilePictureUrl, I got the data from a rest api. Since those data (firstname...) barely changed, i'm thinking to store it somewhere locally. SHould I use KeyChain as well? or SQLLite? XML?
thanks
you can use sqlite to store them in a local database. or NSUserDefault if you are not expecting massive data.
the simplest solution would be to store them in a .plist file
an example tutorial can be found here: http://ipgames.wordpress.com/tutorials/writeread-data-to-plist-file/

how to store JSON Parse data in Iphone Locally?

I want to store JSON parse data(companyName and companyID) in Iphone locally. I also can add or delete JSON parse data(companyName and companyID) in store data.
It depends on the amount of data you wanna store. If it's gonna be less then 1000 I would recommend you to store it as plist, otherwise you can use core data or SQLite.
I'm sure this article will help you out... it's for Flickr but shows how to play with JSON :)
http://iosdevelopertips.com/networking/iphone-json-flickr-tutorial-part-1.html
you can try to use NSUserDefaults if it´s just about a single company, not a collection
https://developer.apple.com/documentation/foundation/userdefaults
if not SQLite would be the best solution

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/

Which database should you use to program an iPhone/iPad application?

I am new to iPhone development and want to know which database you use to program an iPhone/iPad?
I have heard its SQLite, are there any alternatives to this?
The application I am programming is like an online shop however you can't buy products, only view their details.
You should use CoreData for that. CoreData is a database abstraction layer which uses SQLite to store your data. Or you could use SQLite directly. But I would prefer CoreData.
Core Data Programming Guide
Core Data Overview
If you have any plan to use the database file outside iPhone e.g. in other computer, or data input program to populate data, then SQlite is the best choice. CoreData modify the fields name when you create the database inside XCode. But if the data is only accessed by your app in the iPhone, best choice is CoreData.
If you want to run complex sql query then sqlite is better. Read about NSPredicate, what type of query you can do there.
SQLite is the master choice here!
As an alternative, I would suggest you the simplicity of an XML file.
You can also use NSUserDefaults if u have less data to be stored in your database.
http://icodeblog.com/2008/10/03/iphone-programming-tutorial-savingretrieving-data-using-nsuserdefaults/
If the data to be stored is more then go for sqlite