iOS 12 Terminates Background Location Apps

Originator:keli
Number:rdar://47382368 Date Originated:18-Jan-2019 07:59 AM
Status:Open Resolved:
Product:iOS + SDK Product Version:12.0
Classification:Serious Bug Reproducible:Always
 
Summary:
Our app is a location based app and once the CLLocationManager is correctly configured and running it should continue to run indefinitely in the background. On iOS 12 this is not what happens and somewhere between 0-48hrs our app is terminated with no warning.

Steps to Reproduce:
1. Create and configure a CLLocationManager.
```swift
locationManager = CLLocationManager()
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
locationManager.distanceFilter = 50
locationManager.allowsBackgroundLocationUpdates = true
locationManager.pausesLocationUpdatesAutomatically = false
locationManager.delegate = self
locationManager.showsBackgroundLocationIndicator = true
```

2. Request Always Authorization.
```swift
locationManager.requestAlwaysAuthorization()
```

3. Start the Standard Location Service
```swift
locationManager.startUpdatingLocation()
```

Expected Results:
At this point we would expect the app to stay open in the background and be notified of location data periodically. 

Assuming there are no memory issues (which there are not) and there is enough space & memory free on the device (which there is) this should continue to run indefinitely.

Actual Results:
It does continue to run indefinitely on iOS 11, but on iOS 12 the system will terminate the app somewhere between 0-48hrs without any notice to any delegate methods.

Version:
12.0

Notes:
This issue does not seem to be isolated to our case as I have talked to other developers who have seen similar issues and filed bug reports: 47171720, 45581276, 45505724.

There are several ongoing threads about this bug on the Apple Dev Forums as well as a detailed report on StackOverflow of a conversation with Apple Developer Technical Support which suggests that this is a known bug in iOS 12: https://stackoverflow.com/a/53005175

The author of that post has created a bare-bones sample application that demonstrates this issue: https://github.com/flitsmeister/ios-cllocationmanager-background (also attached)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!