Schedule Tasks to execute methods in iOS

可紊 提交于 2020-01-04 02:56:10

问题


I would like to schedule tasks in iOS to execute a method depending on the time of the day and the day. For example, I want to execute startMonitorRegion every day at 10pm and stopMonitorRegion at 10am. I don't want to send a local notification to alert the user, it needs to be transparent for the user.

Is anyway to do it using NSTimer? The app will be in background.


回答1:


You can utilize Local notifications for this purpose.

Just schedule local notification for some date/time. and once user open your app you can perform the required task..



来源:https://stackoverflow.com/questions/13527487/schedule-tasks-to-execute-methods-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!