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 6 years ago.
Improve this question
I'm making an iOS app where I fetch data from a MySql database via a web api (in JSON format). When I load a specific screen the first time should I always save the fetched data local or it is okay that I fetched the data again when the app opens again from being closed/killed? My app has a login in module so right now I only store the current users information local. I also fetch images but those I cache.
You're asking whether to cache the information you download from an API or toss it and grab new every time? This is a very opinionated answer, but to me, it depends on how often the information you're fetching updates or changes itself. Do your users expect to see totally different information every time the app loads? If yes, maybe you don't need to bother caching. The Facebook app, after being killed, opens to a pulsating loading newsfeed. The twitter app, on the other hand, shows you the most recent tweets it loaded then shows an inline notification that more tweets have loaded and you should scroll up to read them. There's no right or wrong answer, it's really up to you.
Related
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 4 years ago.
Improve this question
I'm an educator and wish to build an app for my students. It will be quite basic with a login so they can find their info, invoices, ... But it would be really handy for them to have an app for this instead of using the webbrowser.
But it wouldn't be financially interesting to build an native app from scratch and since this functionality already exists op web. So I would like to use WebView instead to load this part of my website and won't have to maintain the app.
I heard Apple can give you hard time and decline your app if it only uses Webview to load a webpage. Is that correct?
If your site is responsive and within the webview it presents application appearance it becomes easier to be approved. If they refuse you can put a single native functionality to justify being an app, or try to cache the site on the local disk.
You said you have a login system for your students, and it is important to register on the site as well.
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 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 8 years ago.
Improve this question
I'm building an app which fetch posts from server. My question is straightforward: My UITableview has a data source. The data source can load data directly from the server when user hit reload. So why do I want a local store like core data?
One benefit is that loading from a local data store is much faster than loading from a web service. As such, a common pattern is to cache the most recently retrieved data in a local data store and display that while you're making an asynchronous request for any updates.
One example would be Facebook's apps. When you open them from a completely shutdown state they are populated with previously loaded posts, and when a refresh request completes the UI then refreshes with the new data.
The thing to remember is that with mobile devices network connectivity can be highly variable and/or non-existent. If your app requires connectivity and up to date info at all times, then maybe you don't need a local store? But it does help improve the overall user experience generally speaking.
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"];