如何每天在特定时间在iPhone应用程序中调用方法? [英] How to invoke a method daily at a specific time in iPhone application?

查看:104
本文介绍了如何每天在特定时间在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.

请参阅最近问到的相关问题:

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应用程序中调用方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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