开发者

Differentiate between address, city, state, zip in UISearchBar

开发者 https://www.devze.com 2023-02-04 10:46 出处:网络
One of the parameters my iOS application must meet is searching in full or partially by address, city, state, and zipcode.

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消