如何将NSTimeInterval转换为秒(对于backgroundTimeRemaining)(How to convert NSTimeInterval to seconds (for backg

编程入门 行业动态 更新时间:2024-10-28 08:27:19
如何将NSTimeInterval转换为秒(对于backgroundTimeRemaining)(How to convert NSTimeInterval to seconds (for backgroundTimeRemaining))

我正在测试测量剩余的后台任务时间剩余时间。 我已经阅读了几个例子,看到每个人都这样做:

UIApplication *app = [UIApplication sharedApplication]; double *bgTime = app.backgroundTimeRemaining; NSLog(@"Background Time Remaining: %f", bgTime);

但我得到很长的价值,如1797693134862315708145274237317043567980705675258449965989 ...

我知道[[UIApplication sharedApplication] backgroundTimeRemaining]是NSTimeInterval,但有没有办法将其转换为x秒?

我也试过这个 ,但它不会起作用。

任何帮助,将不胜感激。 谢谢。

I'm running test on measuring how much time left for background task time remaining. I have read several examples and saw that everyone doing it like:

UIApplication *app = [UIApplication sharedApplication]; double *bgTime = app.backgroundTimeRemaining; NSLog(@"Background Time Remaining: %f", bgTime);

But I get very long value like 1797693134862315708145274237317043567980705675258449965989...

I understand that [[UIApplication sharedApplication] backgroundTimeRemaining] is NSTimeInterval, but is there any way to convert this to just x seconds?

I have also tried this, but it won't work.

Any help would be appreciated. Thank you.

最满意答案

如果应用程序位于前台,则根据此处的文档,时间将会很长。

If the application is in the foreground, the time will be large as per documentation here.

更多推荐

本文发布于:2023-07-16 02:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1122192.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   如何将   NSTimeInterval   seconds   backgroundTimeRemaining

发布评论

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

>www.elefans.com

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