Differentiate between address, city, state, zip in UISearchBar
One of the parameters my iOS application must meet is searching in full or partially by address, city, state, and zipcode.
I cannot depend on users using commas to separate the data. I also do cannot scan a string for a zip code since the street number could potentially be 5 digits.
I was wondering what 开发者_开发问答standard practice was used to analyze this sort of input. Any help or reference would be greatly appreciated.
One (slightly inefficient) way of doing this would be to make a call to Google's Geocoding API. You'll get results with address component types, such as street_address
, postal_code
, administrative_area_level_n
, etc.
Hope this helps!
精彩评论