Writing Spotlight Search extension in iOS 9

492 views Asked by At

My app shows nearby restuarants based on users current location. On launch of the app, I'm getting the restaurants based on current location and indexing them using the CoreSpotlight APIs. This works well.

Since the user location keeps changing, I need to update the restaurants. I have following questions.

  1. Does the Search extension helps us to update the restaurants in the background based on current location?

  2. The IndexRequestHandler which is a subclass of CSIndexExtensionRequestHandler implements the CSSearchableIndexDelegate methods. How do we access this class in the containing app? I wanted to set this class as my CSSearchableIndex indexDelegate.

  3. Should I need to observe for location updates in my app? This way my app will be launched if not running in the background and I can update the restaurants based on my current location using the CoreSpotlight APIs.
  4. When do we go for Search extension?
  5. As per my understanding, the container app will download the data and indexes it using the batch APIs. If the App quits in between, then the delegate methods are called. In the delegate method, use the fetchLastClientStateWithCompletionHandler method to identify the client state and resume it. Is it a good place to make network calls?
0

There are 0 answers