Iphone 应用程序中的连续时间线?

发布于 2024-09-09 19:39:12 字数 253 浏览 2 评论 0原文

背景:锻炼应用程序设计有一个连续的时间线,然后我可以实时输入我正在做的锻炼和次数,然后实时绘制结果图表。

问题:当 iPhone 休眠时间过长时,我们会失去时间线的连续性并重新启动。我们还没有弄清楚如何在应用程序休眠时保持时间线更新。我让他调用 Iphone 内部时钟,计算观众应该在哪里,然后将他们移动到时间轴上的那个点。然而,他不知道该怎么做。

解决方案: 你们听说过对内部时钟进行此调用的方法吗?也许一个更好的问题是,你能想出另一种方法来解决这个问题吗?

Background: Workout App is designed to have a continuous timeline that I can then input what exercise and reps I'm doing in real-time, then graph the results in real-time.

Issue: When the iphone sleeps for too long, we lose the continuity of the Timeline and it restarts. We haven't figured out how to keep the timeline updating while the App is sleeping. I've asked him to do a call to the Iphone internal clock and do the math on where the viewer should be and move them to that point on the timeline. However, he can't figure out how to do this.

Solutions: Have you folks heard of anyways to do this call to the internal clock? Perhaps a better question, can you think of another way around the problem in general?

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

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

发布评论

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

评论(2

红ご颜醉 2024-09-16 19:39:12

您可以尝试 CACurrentMediaTime 返回mach_absolute_time(以秒为单位)。这在整个睡眠过程中应该是准确的。

You could try CACurrentMediaTime which returns mach_absolute_time in seconds. This should be accurate across sleep.

魂牵梦绕锁你心扉 2024-09-16 19:39:12

没有特定的方法可以确保您的应用程序将永远在后台运行。 (如果这是你需要的)
甚至史蒂夫说的是多任务处理,iPhone资源非常有限,这意味着你的应用程序可能会在没有任何通知的情况下在后台被杀死。
(除了进入后台时收到的通知)

您能做的最好的事情就是降低资源使用率。 (释放尽可能多的对象)
因为当系统需要内存时,它会开始在后台杀死使用更多资源的应用程序。

如果您正在实施流协议,那么情况就会有所不同。

希望这有帮助

There is no certain way that can assure you app will be running in the background for ever. (If this is what you need)
Even Steve said is Multitasking, iPhone resources are very limited and this means that your app will might be killed while it is in the background without any kind of notification.
(Except by the notification you get when entering the background)

The best thing you can do is low your resource usage. (release as many objects as possible)
Because when the system needs memory it will start killing apps in the background starting by the app that uses more resources.

If you are implementing streaming protocols then is different.

Hope this helps

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