SwiftBackgroundLocation icon indicating copy to clipboard operation
SwiftBackgroundLocation copied to clipboard

Should only stop relevant regions

Open asowers1 opened this issue 7 years ago • 3 comments

When BackgroundLocationManager calls ClearRegions, all monitored locations in CoreLocation are being stopped. If users creates a RegionConfig with less than the maximum region per sandboxed app (20), then any other regions that app was monitoring via CoreLocation would also be stopped.

fileprivate func clearRegions() {
        locationManager.monitoredRegions.forEach { region in
            locationManager.stopMonitoring(for: region)
        }
}

asowers1 avatar Nov 28 '17 15:11 asowers1

Great catch @asowers1 . We should fix it. You're welcome to create a PR with it.

yoman07 avatar Dec 06 '17 10:12 yoman07

app not working when backdround: ` if launchOptions?[UIApplicationLaunchOptionsKey.location] != nil { // BackgroundDebug().write(string: "UIApplicationLaunchOptionsLocationKey")

        backgroundLocationManager.startBackground() { result in
            if case let .Success(location) = result {
                //                    LocationLogger().writeLocationToFile(location: location)
                if DataManager.shareManager.currentAccount != nil{
                    
                    NetworkManager.shareManager.postSEND_LOCATION(phone:(DataManager.shareManager.currentAccount?.PHONE)! , longitude: String(location.coordinate.longitude), latitude:String(location.coordinate.latitude)) { (success, _, _) in
                        print(success)
                    }
                    
                }
                
            }
        }
    }`

candangios avatar Jan 24 '18 09:01 candangios

@candangios any solution for your problem im facing the same

yawboafo avatar Sep 10 '20 18:09 yawboafo