I'm constructing an internal instance messager app which is very similar to whatapps. Can someone give me suggestions of how to save the conversation in the local device. Is it ok to archiver the whole UIViewController to save all the messages?
Thanks so much.
You have a number of choice , like you could store in sqllite database , As object using NSUserDefaults and as file in your application sandbox.
And file could be either xml or simple txt format.
Updated:
How to store custom objects in NSUserDefaults
No you need to save history either into NSUserDefaults or save into Sqlite Database.
Related
I'm working on an app, in which I need to seed core-data with some local data stored in a file and I'm using Restkit.
Right now, I have stored the data in JSON format in a text file, and on launch I use the "RKManagedObjectImporter" to map the JSON to objects. Since the data is huge, it takes a lot of time (at least 30 seconds) just to map the data from JSON to Core-data objects.
I obviously cannot make the user wait 30 seconds on the first launch, and the data is required as soon as the app launches. So what alternative do I have here ? Is there a way to create mapped objects and store them in a file ?
Any help will be appreciated!
You can create a Core Data .sqlite file and distribute it with the app instead of a JSON file. Then, when the app launches you can check if the user has an existing store file and, if not, copy the default file from the bundle into the desired location.
RestKit also offers importing support using a .sqlite source file, see here.
In my app, I am writing some data, and I want to save it so that I can retrieve it later. How can I save it and where will it be saved?
Please suggest some ideas...
I think you want to store it in a database using Core Data. If you give more specifics I may be able to give a more specific answer.
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html
NSUserDefaults would be the obvious suggestion.
Other suggestions would be to write it to a .plist file in the documents directory or use core-data depending on how much you would want to save.
My app sends postcards via email. I have to do sent and drafts functionality. When users send postracd it's saved to "sent". All data will be stored via plist files.
How can I make my data (saved plist file) don't be deleted when app will be updated?
Have you considered using Core Data instead of simply storing it as a plist file? If so, there's something called Core Data Model Versioning and Data Migration, maybe you can read up on that? Here's the URL to that:
http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmLightweight.html%23//apple_ref/doc/uid/TP40008426-SW1
Correct answer is here:
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/RuntimeEnvironment/RuntimeEnvironment.html#//apple_ref/doc/uid/TP40007072-CH2-SW7
Content of Documents and Library directories will be copied to the updated app place.
I m creating document files using filemanager which is text file.i want to store this files into sqlite tables?How can i store from iphone and what data types can be used?
Thank u..
Assuming your app is linked to a sqlite library, just create a database and then add tables and data. I'm not really clear where you're getting hung up.
I'm using an NSXMLParser to read data out of a XML, but how can I make my iPhone App storing data into this specific XML.
The case is that I want to create an app to display available dates and one that administrates this dates, whether they are available or not (I'm using an UISwitch to handle this).
Thanks for your answers,
btype.
If you have small amount of data, you can save them in a plist.
See Property List Programming Guide
There's a github project that let's you create XML DOM objects. You can save your XML to your documents folder on the phone.
https://github.com/arashpayan/apxml/