Dynamic content within iOS App? [closed] - ios

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"];

Related

When offline, how to manage data? IOS [closed]

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!

iOS App Preloaded Data Guidance [closed]

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.

iOS - Clear application data on application uninstallation [closed]

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.

Best practices for updating local JSON data file in Swift app? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
My app will ship with a local JSON file for the data, so that everything functions properly offline (because the region the app is based on is hit or miss on connections). I would like to be able to update the local file from time to time with an updated version that is hosted on a server.
Should I download the updated file and overwrite the local file with it, or is there a way to check to see if the file has been updated before downloading?
Also, what event would be best to do these type of tasks on? Downloading the file and overwriting the local copy every time the app runs seems like overkill, but I don't really know how I would go about checking the server file to see if the file is newer before downloading.
I'm new to programming in general, so I don't really know the best practices way to handle something like this.
Any help is appreciated.
This is a general question and there's a lot of implementation details. Try to break things down into several more specific questions.
But a common pattern is to use versioning. That is, at the top of the file is a version attribute. Every time the server updates the file, it religiously increments the version. The client can do a tiny web-endpoint JSON query for just the version number and get back a single integer. It can read its own file on App startup, cache the local version number, and periodically compare.
How often to compare is completely App specific, but the version query will be lightweight and of constant size regardless of how big the file gets.

Same code base in different apps [closed]

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
Here's my problem: Today my company has an app that communicates with a specific server, but we received demands to develop this same App for different servers, so a few things need to be changed in the App (like the URL to call and the logo).
I do not want to create a whole new application with 99% of the code the same in my Xcode just to do that, because it would be really difficult to develop new stuff.
I'm wondering if it's possible to maintain the same base code with just small changes to different applications.
Hope I made myself clear, thank you.
Just to answer my own question, I just found this guide:
https://itexico.com/blog/iOS-Mobile-Development-Using-Xcode-Targets-to-Reuse-the-Code
Different targets and preprocessor macros are just what I needed, pretty sweet!
For something like this, I'd suggest using easy-to-manipulate stuff like plists and so on to make a core app like a framework that would be able to read an XML for example, and parse its data into different fields of your Plist and apply the settings based on that data for every new app that you have.
So, you should have items like url and logo, etc. in your settings Plist, and getting to read them in the app rather than setting values manually inside the app. This way, you'll be able to drop different image files called logo.png for each app, or edit the value for url in your Plist, and the app will read the value from the Plist.
However keep in mind that Plists are good if you don't have a giant list of items, because they can be slow if you get a really big one, but they're so quick and handy for average number of items.
I hope this helps.

Resources