2 Replies
      Latest reply on Sep 11, 2019 9:46 AM by alongPBP
      zulfishah Level 1 Level 1 (10 points)

        I'm trying to use the CLLocationManager to find a user's current location from within a Siri Intent in iOS13. In the intent's handle method, I am setting up the CLLocationManager to make the call, but the delegate calls to didUpdateLocations or didFailWithError don't end up being called at all.


        - (void)handleMyIntent:(MyIntent *)intent completion:(void (^)(MyIntentResponse *response))completion {
          // the handle method is called on an arbitrary queue, so I’m dispatching to main_queue
          dispatch_async(dispatch_get_main_queue(), ^{
                    self.locationManager = [[CLLocationManager alloc] init];
                    self.locationManager.delegate = self;
                    self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
                    [self.locationManager requestWhenInUseAuthorization];
                    [self.locationManager startUpdatingLocation]; 



        I have added the correct usage string in Info.plist. Also, the location manager initializing code does get called. I was getting a warning against using the CLLocationManager on an arbitrary queue, hence I dispatch it to the main queue. But the location manager's locationManager:didUpdateLocations: delegate method isn't called at all.


        Any idea why this might be the case? Is there even something like a 'main queue' in a Siri extension (I'm assuming there is)? I don't think the 'SoupChef' example deals with actually getting a user's current location.