Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need to clear the application data completely while the user is uninstalling an iOS application. These are some of the persistence storages i would target to delete. Please add incase if i miss anything
Keychain
NSDocumentsDirectory
NSUserDefaults
Core data
Sqllite
iCloud
Plist files
CSV
XML
Images & Assets
Does the OS itself takes care of deleting all the files above?
Your app has neither the responsibility nor the ability to perform cleanup when it’s being uninstalled—once the user removes the app, your code ceases to run. On app uninstallation, iOS removes both the app bundle (containing any resources that shipped with the app) and the app container (containing any files that the app wrote within its sandbox while it was running). Some kinds of data, like keychain items that have a group identifier, can persist after the app is removed, but, again, you have no control over that at the point of uninstallation.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I would like to know what are the best practices regarding, Modeling data when no network connection available, if the app you are building is cloud computing based, but still you want to be able to have basic functionality and I guess some persistent data?
PD: I am kind of new to IOS development
UserDefaults is okay for small bits of data that don't change often, but as it has to rewrite the entire user defaults dataset to a file each time a change it made, it is not robust enough for anything of volume or with frequent changes. For that you would want CoreData or a third party open source solution like Realm.io.
You can try to using the 'cache' where you store temporary data.
One way to achieve this is NSUserDefaults where you set a variable (let's say users profile photo) and when the user opens his app again, the image will be loaded even if there is no internet connection since its cached. Hope this helps!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm working on an app with quite a few images and general information about them. Are there any general guidelines about when it is a good idea to just bundle the data with your app and when it should just be downloaded on first run? When you should use Core Data and when just keyed archiving is sufficient? Or is there a better solution I haven't even considered?
I imagine that the data will be updated from time to time, but not frequently. I'd like the app to be able to download updates.
Kind of a vague question, and I apologize for that.
It depends on whether the initial data (images & information) is important and always the same.
If you wish to have it dynamically changed to whatever is updated on the server then you shouldn't bundle it within the app. On the other hand, if the initial data is trivial and you can just include it in the app.
Now if you wish to store the initial data locally in the app, given that the data is just images and theirs information, I would recommend to just use keyed archiving to keep things nice and simple.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want my ios swift app to already have some data in its core data when a user downloads from app store. What are the ways in which i can achieve this ?
You can add the data you want to have previously and include the file in your bundle resources. Then at runtime what you need to do is copy that file to users document directory for live usage and insert update operations should be performed in the live usage file which is in document directory or anywhere you copied. This would be the best approach i think.
So in case of you its a CoreData file. What you have to do is do everything as systematic until you have the required data in the sqlite file of CoreData. Then copy that file and keep in bundle resource. At runtime when app starts before fetching anything and initializing the core data objets, replace the file in the destination directory with the bundle file.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I developed an iPhone game in Swift using Xcode. It needs to store settings as well as user data. How do I get the app's settings and data to save when it is restarted or quit?
As mentioned in comments, use NSUserDefaults for settings. For "large files" it's more likely you mean "user data". In that case, you can use Core Data or store your own NSCoding-compliant data model via NSKeyedArchiver (and unarchived via NSKeyedUnarchiver) or their ...Secure... alternatives to write to your app's documents.
Rather than save only when the application's state changes, you should probably persist small changes as they're made (this is basically what NSUserDefaults does) or as some logical group of changes are made (what constitutes a "logical group" depends entirely on the nature of the data and your app and is therefore up to you).
So: Identify the "settings" and store them the right way (in NSUserDefaults). Then identify your user's game data and store that the right way (in some sort of data file).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I’m creating an iOS app for a local restaurant though which users can view the menu. The restaurant would like the ability to update the menu dynamically (ie. without having to go through the full Apple release procedure). In my mind this should be pretty simple, there could be a JSON/Plist file hosted online which the app accesses when presenting the menu, it could store the data locally then each subsequent time it could just check the version number to see if it’s changed and update accordingly. (Alternatively it could just download and present the whole thing every time since the files likely to be tiny).
The bit I’m struggling with is where to host the file (where I can update it occasionally) and how to access it within the app. Seems a lot of work writing a server and an API for one small file. Could it be put on Dropbox and accessed from there or is that likely to be unreliable?
For anyone else reading this I found the perfect solution - https://github.com/mattt/GroundControl
You could host the menu on an appache webserver and everytime the app is started you check the current version of the file on the device against the one on the server and download it if the version number is above that one.
Read a .plist file to a NSDictionary:
NSDictionary *menu = [NSDictionary dictionaryWithContentsOfFile:#"menu.plist"];