This sample demonstrates how to use the geocoding to search for points of interest, around a location or within a particular extent. You specify a point of interest (e.g. Starbucks) and then choose between your current location, any other location, or for a generic search, just leave it blank. As soon as you start typing the app gives you suggestions in a dropdown list. When you tap on the search button the resulting locations are shown as pins on the map. You can get more details about these locations by tapping on the pins. If you want to search the visible map extent just click the 'Redo search in this area' button.
How it works
To get suggestions while you are typing the sample uses the suggestWithSearchText:parameters:completion: method on the AGSLocatorTask. The suggestions are restricted using categories on AGSSuggestParameters.
If a proximity location is specified, the sample uses the geocodeWithSuggestResult:parameters:completion: method on locator task to find out the coordinates for that location. The sample uses that location as the preferredSearchLocation, in the AGSGeocodeParameters, to find the points of interest you entered as the text. This is performed using the geocodeWithSearchText:parameters:completion: method.
If you tap on the 'Redo search in this area' button, the same method is called but a search area parameters is also specified using the map view's visible area extent.