-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSInternalInconsistencyException in CLLocation Manager setAllowsBackgroundLocationUpdates #393
Comments
I'll try to replicate this issue today. Can you post what version of iOS you're testing on? |
Great! I'm on iOS 11 coding on XCode 8 |
How are you deploying to iOS 11 with Xcode 8? Xcode 8 doesn't include the necessary symbols to deploy to iOS 11 devices. |
Sorry I meant iOS 10.3.3 coding on Xcode 8. |
Tested this scenario in a sample project and did not run into the issue mentioned. However doing some research on it, that issue can arise when a developer doesn't add the correct plist entries for background modes and location privacy keys. I would double check your plist entries and make sure everything is set up correctly. This also caused me to double check our sample app and noticed that technically our sample app is iOS 10 incompatible, so I opened #394 to track that. Below is the code I used to test it. Perhaps it will give you some insight into what you're facing: import UIKit
import Mapzen_ios_sdk
import CoreLocation
class ViewController: MZMapViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
locationManager.requestAlwaysAuthorization()
}
override func authorizationDidSucceed() {
super.authorizationDidSucceed()
if locationManager.canEnableBackgroundLocationUpdates() {
_ = locationManager.enableBackgroundLocationUpdates(forType: .other, desiredAccuracy: kCLLocationAccuracyBest, pausesLocationAutomatically: false)
}
}
//Not necessary to override - only added so we can see this update in the background.
override func locationDidUpdate(_ location: CLLocation) {
print("Location did update!")
super.locationDidUpdate(location)
}
} You'll also want to make sure you set your API key in your app delegate. |
Indeed I needed to set the "Required Background Modes" to "location" in my plist file! But FYI, this is the first time I hear of this entry. |
Description
Reported by @nolispe280 in #390 -
"I have managed to load the SDK 1.1.1 via cocoapods (had to uninstall and reinstall it). I then added this code in the viewDidLoad function:
but still get the above error.
Does anyone else have this issue?"
The text was updated successfully, but these errors were encountered: