如何每天在特定时间在iPhone应用程序中调用方法?

编程入门 行业动态 更新时间:2024-10-15 12:29:35
本文介绍了如何每天在特定时间在iPhone应用程序中调用方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想每天在特定时间在我的iPhone应用程序中调用一个方法. 我该如何实现?

I want to invoke a method daily at a specific time in my iPhone application. How can I achieve this?

推荐答案

使用iPhone SDK和封闭的应用程序,您无能为力.您可以让它在特定时间发送本地推送通知,但是只有在用户手动打开您的应用后,该通知才能执行.

There's not a whole lot you can do with the iPhone SDK and a closed app. You can have it send local push notifications at specific times, but that won't execute your code until the user manually opens your app.

请参阅最近问到的相关问题:是否可以在iOS中让我关闭的应用运行代码?

See this related question recently asked: Is it possible to have my closed app run code in iOS?

我见过应用程序所做的一件事(例如闹钟应用程序等)是让您的应用程序保持打开状态,只是让手机进入睡眠状态,然后它仍会在您需要时执行代码.但这仅在用户未按下主页按钮的情况下有效.

One thing I've seen apps do (like alarm clock apps, etc) is have you leave your app open and just let the phone fall asleep and then it will still execute code when you want it to. But that only works as long as the user doesn't hit the home button.

更多推荐

如何每天在特定时间在iPhone应用程序中调用方法?

本文发布于:2023-11-27 13:36:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1638296.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   时间   方法   在特定   iPhone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!