Вопрос

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.

Другие советы

Because NSTimeInterval is a float or double, but not a pointer. double *bgTime should be double bgTime.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top