Post

Replies

Boosts

Views

Activity

[BUG] App not launched by location updates when terminated
I have an app that requires the location of the user in the background to trigger certain events and notifications, similar to life360; if the user terminates the app, background location updates need to continue. However, the app is never launched by the system. My plist: <key>UIBackgroundModes</key> 		<array> 				<string>fetch</string> 				<string>location</string> 				<string>processing</string> 				<string>remote-notification</string> 		</array> I have configured my CLLocationManager like so after receiving "Always" location permission: locationManager = CLLocationManager() locationManager.delegate	= self locationManager.allowsBackgroundLocationUpdates = true locationManager.pausesLocationUpdatesAutomatically = false locationManager.distanceFilter = kCLDistanceFilterNone	 locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.startMonitoringSignificantLocationChanges() And I have setup the willFinishLaunching function like this to test if my app is summoned upon location change: func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { 		if launchOptions?[UIApplication.LaunchOptionsKey.location] != nil { UserDefaults.standard.set("Background Update Received", forKey: "locationUpdate")	 		} 		 		return true 		 } To isolate the problem and allow the community to investigate with greater productivity I have created an extremely simple app - https://github.com/Ludotrico/LocationTest to illustrate the problem. https://github.com/Ludotrico/LocationTest The past few hours I have been driving around my city with my app terminated trying to trigger the location update but it has never happened. My iPhone has background app refresh on, and "always" location permission. I have seen the process to be tedious and immensely time consuming. Am I missing something? Is there a better way to test this than driving around all day wasting gas?
1
1
827
Aug ’20