I am working with the date in my iPhone development. I need to increase the date by 24 hours from the current date.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
Save the download date in the NSUserdefaults then check if 24 hours have passed? If not notify the user that he/she will have to wait.
You can use dateByAddingTimeInterval
Depending on what you are really trying to achieve, just adding 86,400 (or 60 * 60 * 24 ) to your time interval might not be what you want. If for example, the user experiences a daylight-savings adjustment, then you will be off by an hour, or even a day if it happens near midnight. A better method is to ask the NSCalendar for the result, which takes into account the users local time zone.
Try
save the last download date in NSUserDefaults. And when you try to download just check for that date.
something like this:
you can call
[self downloadDataForecedUpdate:NO]
whereever it is appropriate. on application launch or in an IBAction. Use the return value of the method to either show a download indicator or a alert that tells the user he has to wait more.Simple: