Determine iPhone user's country

前端 未结 5 1363
天涯浪人
天涯浪人 2020-12-05 02:41

I need to determine at startup what country a user is in, for an iPhone application. Presumably I will have to turn on location services and do some sort of reverse geocodin

5条回答
  •  执念已碎
    2020-12-05 03:17

    If you don't want to use the Google services provided by the iPhone SDK, couldn't you just store the coordinates of the US of A borders and check whether or not you are inside that?

    Here is a relevant question in that case How can I determine whether a 2D Point is within a Polygon?

    If the purpose of the limitation is something other than user experience (for example, to enforce complicance with some specific US law), i.e. when the user can not be trused, I would say that you need some more rigorous checking (after all, the user would simply disallow the use of location services otherwise, wouldn't he/she?).

    One such approach would be to do an IP lookup, e.g. http://www.maxmind.com/app/geoip_country

提交回复
热议问题