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

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

问题描述

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

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

谢谢.

解决方案

像这样的背景任务在iOS中不容易完成,Apple阻碍了我们这样做.

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

有很多方法可以阻止此类后台任务,并且它们在工作时会被视为"hacks",Apple可能会拒绝您使用这些任务的提交,或者更糟糕的是,一旦拥有成熟的用户群,您的应用就会突然退出.

我会重新考虑您的建议,但是如果您仍然想继续前进,我的方法将是:

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

但是请注意,这涉及到另一个组件,即Web服务器.此外,这不是Apple或我本人的原谅,但这仍然是一种方法.

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.

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

Thanks in advance.

解决方案

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

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?

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:

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.

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天全站免登陆