如何比较经度和纬度以检查来源和目的地是否在同一国家/地区使用 google 地点 api

How to compare longitude and latitude to check the source and destination are in the same country or not using google place api

我正在尝试使用 google api 在地图上添加方向,我已按照此 link 在地图上显示路线 Drawing a route in MapKit in iPhone SDK

它工作正常,现在的问题是当我在不同国家/地区搜索源和目的地时,应用程序会崩溃,提示 *** Terminating app due to uncaught exception 'NSInvalidArgumentException',原因:'Invalid Region '.

我可以想到两个解决方案: