利用XCode进行iOS模拟定位

利用XCode进行iOS模拟定位

  1. 打开项目的scheme配置

  2. 在options中打开Allow Location Simulation开关,在Default Location中有常用的地点供模拟

  3. 手动编写gpx后缀的文件

在这个网站查询对应地点的经纬度: https://jingweidu.51240.com/,填入下面的xml文件中

location.gpx


<gpx version="1.1"
    creator="GMapToGPX 6.4j - http://www.elsewhere.org/GMapToGPX/"
    xmlns="http://www.topografix.com/GPX/1/1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
    <wpt lat="33.06784" lon="107.03194">
    wpt>
gpx>

  1. 回到第3步,将创建好的gpx文件添加到工程里面,然后跑起来,手机上的定位已经模拟到gpx文件中的经纬度,对所有app有效。

你可能感兴趣的:(iOS)