简体   繁体   English

Webview.reload在后台Xcode 8.2 swift 3中

[英]Webview.reload in background Xcode 8.2 swift 3

Happy new year to all. 祝大家新年快乐。

Is it possible to make a uiwebview.reload if my app is running in background? 如果我的应用程序在后台运行,是否可以创建uiwebview.reload I have a Timer with interval 20 seconds an random number 0-N + function that make number = number + 20 . 我有一个定时器,间隔20秒是一个随机数0-N +函数,该函数使number = number + 20 If number > random number then webview.reload . 如果number> random number, webview.reload This works good on iOS 10.2 in simulator i press home button and lock. 在模拟器上的iOS 10.2上,我按下主页按钮并锁定,效果很好。 But it will not working on my device iPhone 6 iOS 10.2. 但是它不能在我的设备iPhone 6 iOS 10.2上运行。 Is it possible to make webview.reloading in background? 是否可以在后台进行webview.reloading Sorry my English is not good. 对不起,我的英语不好。 In my project settings capability background is ON and I check background fetch 在我的项目设置中,功能背景为开,并且我检查背景提取

If you know background fetch, this is hard to debug on a device because you're not guaranteed it is called in the amount of time you specify. 如果您知道后台获取,则很难在设备上进行调试,因为不能保证会在指定的时间内调用它。

setMinimumBackgroundFetchInterval means that it is not called in an interval which is smaller than the value you specified. setMinimumBackgroundFetchInterval表示不会在小于您指定的值的间隔中调用它。 But there's no setMaximumBackgroundFetchInterval. 但是没有setMaximumBackgroundFetchInterval。 So if iOS decides to call your app just once a day or even just once a week. 因此,如果iOS决定每天或每周仅一次调用您的应用程序。 It won't be called more often regardless your minimumBackgroundFetchInterval. 无论您的minimumBackgroundFetchInterval如何,都不会更频繁地调用它。 AFAIK iOS decides when to call performFetchWithCompletionHandler measured by the pattern when and how often the users start's the app. AFAIK iOS决定何时调用performFetchWithCompletionHandler,具体由模式决定,何时以及用户启动应用程序的频率。

Can you write same code to set fetch interval? 您可以编写相同的代码来设置获取间隔吗? And I will call my app every 0-10 minutes. 我会每0-10分钟拨打一次我的应用程序。 The system send all apps down every 3 minutes if I make fetch interval 170 seconds? 如果我将获取间隔设为170秒,系统将每3分钟发送一次所有应用程序? Will this working? 这样行吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM