Calculate distance traveled geolocation

Is it possible to calculate the distance in real time using geoLocation?

For example: A user starts running and the screen will appear the distance traveled, style the application nike + run

I used gelocation at another opportunity and I remember that if the user closed the application the gelocation stopped. There was a way to always get activated, but I have doubts if it is the best solution and if the apple store approves.