In my application on the iPhone and iPod Touch I want to be able to retrieve the country a person is in without accessing the internet. I know how to do this with internet, so I know how to retrieve the longitudes and latitudes, I've read something about a file with the world borders included, but I don't know how to use this in objective-c on the iPhone.
Does anybody know 开发者_StackOverflow中文版a fairly easy solution to retrieve the country name from the iPhone's GPS-coordinates without using internet?
If you have a file with country boundaries in terms of lat/long in decimal form, you can create an enclosed shape. Then take the user's current location as a point and use simple geometry to see if the point is enclosed within the shape.
This is not ideal. A better idea might be to guess based on the current localization of the device. Also not ideal (many countries other than Spain in which Spanish is spoken.
There's just not a very good way to achieve what you want AFAIK.
精彩评论