iOS: Fire notification after time period and keep track of time [closed] - ios

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 writing a game where the user can have N lives, where each life is replenished after a set period of time, T.
What is the best way to implement this in iOS, given that the user may or may not have the app opened when a life replenishes.
I was thinking that I could fire a UILocalNotification, but is it guaranteed that this will always be fired (e.g. what if the phone was turned off)?

You don't want to use a notification for this as it is presented to the user. Instead, while the app is open you should be running a timer and replenishing when it fires. You should also be storing the replenish date, perhaps in user defaults or the keychain, so that if the app is closed you can compare that date to now when it is opened again and determine how many to replenish.

Related

run code every 10 minutes when app is Terminate [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 7 years ago.
Improve this question
I want to run a code every ten minutes for ever. I used a NSTimer but when the app is in Background or Terminate the timer stops. I developed a game
Just store time, when app is terminated(or send background). When user open your app in next time, load this time. Check with current time and make changes in points.

How to run method every X hours even when the app is closed? [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 8 years ago.
Improve this question
I'm using Objective-C for iPhone development and I'm wondering how to create a method that checks something (maybe make a GET request to some API every hour) even when the app closed.
Is there any built-in mechanism that can do that?
"Run always?" What does that mean? If you have a "while (true) block in your program it will lock up and the system will kill it for being frozen.
iOS devices are event driven, and need processor time to respond to user actions and system events.
Probably your best bet is a repeating timer on a fairly short interval. I would advise against making the interval much shorter than 50 times a second though, since timers aren't accurate at intervals shorter than that.
What is the problem you're trying to solve?

How long does a small update take? [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 9 years ago.
Improve this question
I might have a new app ready in a couple of days so I'm not sure if I should use the slot available right now to update my old app. I want to get the new app in the store asap.
How long does it take usually for small updates like graphic changes or just simply changing the name of your app?
All updates, small or large will go thru the same review process. An update to an app can take anywhere between 3 to 6 days. But I've had an update that took 4 weeks. you just never know.
If you go to the App Store Approval Process page you will see that 99% of all updatw will be revied within 5 days.
Normally a simple update takes 2-3 days..but not sure may take upto 10-15 days.

Determine if user is signed in or not by other user in parse.com [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 9 years ago.
Improve this question
In my game, I need to do a check to see if another player is signed in or not, if they are then I cannot attack them. Right now I'm doing that by setting a Boolean when the user signs in, and then setting it to NO with applicationDidEnterBackground, but I've been told this sometimes doesn't run especially if the App crashes.
So my question is, are there any other ways to determine if a player is signed in or not?
applicationDidEnterBackground will generally be called. If you're worried about crashes you can implement an uncaught exception handler. You can also consider having a, relatively infrequent, keep alive update sent to the server periodically and auto-logout the user if it isn't received.

Keeping track of the last time a user took an action [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
I have an app which allows users to redeem voucher codes, however I want to limit it so they can only claim one every 30 minutes.
So I somehow need to store the time they last redeemed a voucher, and if they try to redeem another, the app would check the last time and only give them a new voucher if the last one was over half an hour ago.
Would I store data in user prefs or is there a better way?
Storing a timestamp of when the last voucher was redeemed in NSUserDefaults is probably fine for a simple solution.
But how secure do you need this to be? As a general rule, and especially if this needs to be strictly enforced for financial reasons, never trust the client. Meaning that you should have a server to verify the codes, and enforce usage restrictions.

Resources