每月在后台进程中更改壁纸

发布于 2024-11-08 04:46:22 字数 208 浏览 4 评论 0原文

我正在开发一个项目,我想为每个月分配一张图像,以便在使用此应用程序时,iPhone 壁纸会随着月份的变化而变化。

图像的分配及其在数据库中的存储已完成。月份变化时如何设置壁纸?这是剩下的问题。我认为该进程应该使用 NSTimer 在后台运行。这是否正确?

如果是正确的,那么我该如何编写代码呢?如果是错的,那么换什么壁纸合适呢?请提供相关信息。

I am working on a project in which I want to assign an images to each month, so that when using this application, the iPhone wallpaper changes when the month does.

The assignment of the images and their storage in a database is complete. How do I set the wallpaper when the month changes? This is the remaining problem. I think that the process should run in the background by using NSTimer. Is this correct or not?

If it is correct, then how do I write the code for that? If it is wrong, then what is suitable for changing the wallpaper? Please provide information for that.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

金兰素衣 2024-11-15 04:46:22

您确定可以通过该应用程序更改壁纸吗?我以为这不可能?

无论如何,NSTimer 不会帮助你,因为你必须确保应用程序全职运行,这在 iPhone 上是不可能的。当应用程序进入后台时,无法知道它会驻留多长时间,因为如果需要回收这些资源,操作系统会杀死它。

事实上,模仿这一点的唯一方法是在启动时检查当前日期,然后确定是否需要发生任何事情。

Are you sure that you are able to change the wallpaper through the app? I thought this wasn't possible?

Regardless, NSTimer won't help you because you would have to ensure that the app is running full-time, which is not possible on the iPhone. When the app goes in the background there is no way to know how long it will stay resident, as the operating system will kill it off if it needs to reclaim those resources.

In fact, the only way to mimic this would be to check the current date at startup and then determine if anything needs to happen.

溺孤伤于心 2024-11-15 04:46:22

这是

苹果的硬件限制,因此不能通过 iPhone 库中存在的任何类或方法来完成。

This is the answer

Hardware restriction from apple so cant be done by any class or method present in the iPhone library.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文