In your processNewLocation(_:) function you are stoping the location updates. The app will likely be closed by the system shortly after, a Timer object cannot keep the app running in the background.
You can check this repository which basically is a simple tracking app:
https://github.com/JFCaBa/TrackingApp