How to calculate the current user location in Watch Kit extension as we can't use CoreLocation
in watch kit.
Thanks in advance
How to calculate the current user location in Watch Kit extension as we can't use CoreLocation
in watch kit.
Thanks in advance
The answer by Stephan should work (haven't tested it), with just one exception. WatchKit requires "Always" permission for the location manages. This is because your phone is really running the watch extension, in background mode. So if you only ask for "When in Use" permission, you will never get locations returned to your watch extension.
Try changing the line:
with:
You can use CoreLocation in your watch app extension very similarly to how you use it in your iPhone app. The key difference is that a user can't authorize your extension to have access to Core Location. They will need to do that from your iPhone app. So you will need to check if the user has authorized location services for your app and if they haven't, you will need to instruct them how to do it.
Here is the code I use in my watch kit extension for tracking the current location. (
GPWatchAlertView
is a custom controller I made to show alert messages.)you should get user location on iphone app not in extension. Please check apple documentation.