iOS的背景获取模式可用于安排在未来的某个操作实际上并没有获取远程数据? [英] iOS Background Fetch mode can be used to schedule some operation in the future that doesn't actually fetch remote data?

查看:111
本文介绍了iOS的背景获取模式可用于安排在未来的某个操作实际上并没有获取远程数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这样做,需要重新安排每日本地通知的应用程序。我知道有关按repeatInterval 属性,但repetitioon这里就像每个2天等结果
我见过沉默的通知,但他们只能用推送通知使用,并且由于一些要求我不能使用这种方法。结果
现在,应用程序的工作原理上,用户将打开应用程序已经足够重新安排这些通知的假设。这个假说是好的,我们都同意,将工作,但我会更有信心,如果有可能重新安排他们每天的基础上,而无需打开应用程序。结果
我已经看到了新的API背景提取,这可能是对我真的很好,但是从doc和WWDC视频我不明白,如果有可能使用一切,或只是为了获取远程数据。

I'm doing an app that requires to reschedule local notification on daily basis. I'm aware about the repeatInterval property, but repetitioon here is like each 2 days etc.
I've seen silent notifications, but they can be used only with push notifications and due to some requirements I can't use that approach.
Now the app works on the hypothesis that the user will open the app quite enough to reschedule those notifications. This hypothesis is fine and we all agree that will work, but I will be more confident, if it would be possible to reschedule them on daily basis without opening the app.
I've seen the new API Background Fetch, this could be really good for me, but from doc and WWDC videos I didn't understand if it is possible to use for "everything" or just to fetch remote data.

推荐答案

据我了解,你能做到这一点并不需要太长的一切,再加上你没有得到保证的间隔,当你的应用程序将被唤醒 - 你只可以要求一定的最小间隔唤醒,这将被视为内部监督办公室的建议。

As I understand you can do everything that does not take too long, plus you don't get a guaranteed interval when you app will be woken up - you just can request a certain minimum wake interval, which will be treated as a suggestion by iOS.

,唯一的缺点是,显然你必须创建一个 NSURLSession 实际上做一个网络请求,在其返回你可以做任何你想要的。 所以,你可以做一个假的请求,而忘记了任何数据,你得到返回,或者甚至创建一个失败的请求,因为你不感兴趣的所有任何真正的要求 - 尽管我不知道什么,当你实现后者苹果会做...

The only catch is that apparently you have to create an NSURLSession and actually do a web request, upon which return you can do whatever you want. So, you can do a dummy request and forget about any data you get returned, or maybe even create a failing request, as you are not interested in any real request at all - although I'm not sure what Apple will do when you implement the latter ...

这篇关于iOS的背景获取模式可用于安排在未来的某个操作实际上并没有获取远程数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆