iOS:如何在 X 小时内每隔几小时使用处于睡眠模式的 iPad 自动发送电子邮件? [英] iOS: How can I send an email automatically with an iPad in sleep mode every hours during X hours?

查看:62
本文介绍了iOS:如何在 X 小时内每隔几小时使用处于睡眠模式的 iPad 自动发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种发送电子邮件的方法,效果很好,但我想自动发送,即使 iPad 处于睡眠模式.

I have a way to send email that works perfectly, but I would like to send it automatically, even if the iPad is in sleep mode.

发送电子邮件的方式在这里:如何才能我在 iOS 中使用 API MailJet 以编程方式发送带有附件的电子邮件?

The way to send email is here: How can I send an email with attachement using the API MailJet in iOS programmatically?

提前致谢.

推荐答案

像这样的后台任务在 iOS 中并不容易完成,Apple 设置了障碍来阻止我们这样做.

Background tasks like this are not easy to accomplish in iOS, Apple places obstacles in our way to prevent us doing so.

由于 Apple 不希望我们这样做,您应该问问自己为什么需要这样做.您打算发布这些作品并让其他人使用此功能还是仅供您使用?

As Apple don't want us doing this, you should ask yourself why you need to do it. Do you intend to publish these works and have others utilise this feature or is it for use by you only?

有很多方法可以伪造此类后台任务,虽然它们可以工作,但它们被视为黑客",Apple 很可能会拒绝您提交的使用它们,或者更糟糕的是,一旦您的应用程序已经建立了用户群,它就会突然拉动您的应用程序.

There are many ways to fudge background tasks like these and whilst they work, they are considered 'hacks' and Apple may well reject your submission for utilising them, or worse, pull your app suddenly once it already has an established userbase.

我会重新考虑您的提议,但如果您仍想继续,我的方法如下:

I would reconsider what you are proposing, but if you still want to go ahead, my approach would be the following:

创建一个应用程序也使用其 APNS 推送令牌发布的网络服务.然后,此网络服务每 6 小时向设备发送一次静默推送,将其从后台唤醒并允许其执行任务.

Create a webservivce that the app posts too with its APNS push token. This webservice then sends a silent push to the device every 6 hours, waking it from the background and allowing it to perform its task.

但是请注意,这涉及到另一个组件,即网络服务器.此外,Apple 或我本人都不会宽恕这种做法,但它仍然是一种方法.

Note however, this involves having another component, the webserver. Furthermore, this is not condoned by Apple or myself, but it is an approach nonetheless.

这篇关于iOS:如何在 X 小时内每隔几小时使用处于睡眠模式的 iPad 自动发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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