backgroundTimeRemaining returns (35791394 mins)?
Try this:
NSLog(@"Background time remaining: %f seconds (%d mins)", timeLeft, (int)(timeLeft / 60));
How to convert NSTimeInterval to seconds (for backgroundTimeRemaining)
If the application is in the foreground, the time will be large as per documentation here.
What is this big number for backgroundTimeRemaining
As your new to ios coding, a little tip:
Hold ALT and click on backgroundTimeRemaining. It tell's you it returns an NSTimeInterval which is a double, so using %f is not the problem.
If you click the bottom blue link of the popup it'll open the docs and you'll see it says that this figure will be very large if the app isn't actually in the background.
So I'm guessing this is your issue, that your app is in the foreground when the NSLog is printed.
Related Topics
Showing Hidden View Really Slow
Change Splash Screen Image Programmatically
Please Add the Host Targets for the Embedded Targets to the Podfile
Nsurlsession/Nsurlconnection Http Load Failed (Kcfstreamerrordomainssl, -9802) on a Subdomain
Uicollectionviewcontroller Error in Swift 3.0: Must Be Initialized with a Non-Nil Layout Parameter
Stream Data from Network in Avaudioengine, Is It Possible
App Installation Failed: Unknown Error Xcode 7
Give Thumbnail Image with Uiactivityviewcontroller
iOS 8: Autorotation Is Not Working Without Storyboard
How to Detect Which Image Has Been Tapped in Swift
Coredata Conditionally Fetching on Nsdate Using Nspredicate (Swift)
Animating Strings Fading In/Out in Swift
Swift Do Subclasses Inherit Initializers
Custom Mkoverlayrenderer Drawmaprect Function Not Drawing Polygons
iOS 3Des with Ecb Return Half Correct Data
How to Go Back to Rootviewcontroller from Presentview Controller
Binary Operator + Cannot Be Applied to Operands of Type Cgfloat Int