iOS globally accessible current User? [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
What is the best practice for having globally (e.g. from all view controllers) accessible current User object?
I am using core Data.
EDIT:
I just realized I should elaborate a bit (and immediately received a comment regarding that)..
current User means the user who is the owner of the phone and is associated with an entry in the remote database. User enters login/password (or registers) and then can access the remote server, get data etc..

Object visibility is a major part of app architecture. It is up to you to make your objects visible to the other objects that may need a reference to it. No simple rule can be given. I have tips in my book on how to make objects visible in an absolutely global way:
http://www.apeth.com/iOSBook/ch13.html#_global_visibility
For example, store a reference in the app delegate, which every other object can easily get a reference to. But there are lots of other solutions and approaches (which that chapter also talks about). It's a matter of planning ahead.

Related

How to model common information for Rails application [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 4 years ago.
Improve this question
I'm a bit new in rails development I'm modeling a website with few resources and so far so good. But here is my question:
I would like to allow the admin users to manage information show in most of the pages: Application name, telephone number, address, default email and this kind of things.
My current idea is make a model Property with name and value, but somehow I'm not convinced about this approach because I'll need to access the database to get this values for every request.
Thanks everyone for your time! :D
This seems like an OK approach. If you implement caching, it no longer will hit the db with every request, and honestly it probably isn't really that big of a deal even without the caching. Build it the way you need, and optimize afterward, if necessary.
With all this being said, it may be worth considering how much things like the phone number are going to change, and balance the cost of developing a dynamic solution against the time it would take to change once, 3 years from now (if the number ever does change), in a partial.

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.

In Firebase, How do I prevent memory-modification cheats (iOS) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have Users table in Firebase. However, users can change our scores, etc. How can i handle this situation ?
Thanks
In general I recommend storing the actual moves that a user has made in the game, in addition to the score they achieved. At the very least you can then replay those moves to see if the score is correct or manipulated. But you can also further analyze the moves to see if they were made by the player or seem synthesized.
You can use Firebase's security rules to validate the moves of certain games. But depending on the game this may be beyond what you're willing to write security rules for. In that case, you should write the (move and score) validation into a back-end process that runs in a trusted environment. This may be a an app server you control, but it also be as simple as a process you periodically run on your own machine.
Some links that cover the same/a similar topic:
Firebase complex validation
Firesafe: Add Complex Security Logic to Your Firebase App
can Firebase be used to backend Unity MMOs?

Solution for voting without attachment to a model? [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
My application is one page contract. I would like users to be able to sign the contract by clicking on a button. The contract is not a resource; it's plain HTML.
Every solution I have found so far relies on having a model that acts as votable. How can I implement a simple button that users may only click once, and display the number of users who have clicked it?
It's not possible to do this with static pages, at least not in a way that is clean and secure.
Think about it this way: every user is looking at a copy of the contract, which is being displayed to them on their browser (the client). If you want users to be able to cast votes that persist and be aware of votes cast by other users, then you need a server that keeps track of it centrally. That's why the solutions you have found so far rely on having a model, presumably backed with a table.

Resources