Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the current location in watchOS 2?

Tags:

I need to fetch the user current location for the WatchKit App in watchOS 2. How do I do this?

like image 557
Jyothi Avatar asked Jul 28 '15 07:07

Jyothi


People also ask

How do I see location on Apple Watch?

Open the Find My app. Choose the Devices tab. Select your Apple Watch to see its location on the map.

Why is my Apple Watch not showing its location?

Another place to check is on the watch in settings/privacy/Location Services and make sure this is turned on and scroll down to apple watch workout and select while using the app.

How do I get my Apple Watch to sync to my current location?

On your iPhone, in the Watch app, go to: My Watch (tab) > Weather > Default City > choose Current Location (or a specific location from those that have been added to the Weather app on your iPhone, if preferred).

Can you see someones location on Apple Watch?

If you use the Find My app on iPhone, iPad, or Mac, then you have a similar tool for locating people with your Apple Watch. On watchOS 6 or later, the app is called Find People and on watchOS 5 or earlier, it's Find My Friends. But both apps do the same thing and can help you track down your loved ones.


1 Answers

The other answers are incorrect. You can request location directly on the watch for watch OS2. The available method is called requestLocation. It allows you to request a single location update.

E.g.

#import <CoreLocation/CoreLocation.h>
@interface className : WKInterfaceController<CLLocationManagerDelegate>

Then where you want to request location:

self.locationManager = [CLLocationManager new];
self.locationManager.delegate = self;
[self.locationManager requestWhenInUseAuthorization];
[self.locationManager requestLocation];

Then you will get a single callback in one of the following CLLocationManagerDelegate methods.

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
    // Callback here with single location if location succeeds
}

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
    // Error here if no location can be found
}

See the WWDC15 video "What's New in Core Location" - https://developer.apple.com/videos/wwdc/2015/?id=714

Imgur

like image 61
danielbeard Avatar answered Nov 17 '22 21:11

danielbeard