Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 基于增量随机时间间隔的计划通知_Ios_Objective C_Localnotification - Fatal编程技术网

Ios 基于增量随机时间间隔的计划通知

Ios 基于增量随机时间间隔的计划通知,ios,objective-c,localnotification,Ios,Objective C,Localnotification,如何根据增量时间跨度安排通知 10分钟、10小时、20小时、1天、5天、1周、1个月、5个月、1年、5年、10年。 Notification Message: for 10 min You have completed Successfully 10 min for 10 hours You have completed Successfully 10 hours 根据所提供的少量信息,我将继续如下: 查看NSUserDefaults以了解上一次迭代是什么 基于上一次迭代定义开始时间(如果有)

如何根据增量时间跨度安排通知

10分钟、10小时、20小时、1天、5天、1周、1个月、5个月、1年、5年、10年。

Notification Message:
for 10 min
You have completed Successfully 10 min
for 10 hours
You have completed Successfully 10 hours

根据所提供的少量信息,我将继续如下:

  • 查看NSUserDefaults以了解上一次迭代是什么
  • 基于上一次迭代定义开始时间(如果有)
  • 使用iOS SDK中提供的计划本地通知
  • 将相同的日期/时间保存在
    NSUserDefaults
  • 一旦我们到达那个时间,通知将被发送(通过iOS),我们可以执行代码来重复这个序列

  • 只需安排第一个通知,然后在它触发时安排下一个通知,依此类推。给定问题并没有实际说明,一个合适的用例,您实际上想要实现什么。提供更多细节,以便提出更好的解决方案。