Regardless your code works or not, your background task will be terminated after a while (>10 minutes) by iOS unless the UIBackgroundModes is set in your app (VOIP, Location service, Audio ..).
For more about Background Execution check Background Execution and Multitasking.
Another option in iOS7 is using Background Fetch, but you don't have control over time (there is a smart Timer used by the iOS).
For better understanding check Raywenderlich's Background Modes in iOS Tutorial.
And if you need something working check the below SO posts:
How do I get a background location update every n minutes in my iOS application?
Running iOS App in background for more than 10 minutes
Will iOS launch my app into the background if it was force-quit by the user?