国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > php开源 > 综合技术 > ios9定位服务的app进入后台三分钟收不到经纬度,应用被挂起问题及解决方案

ios9定位服务的app进入后台三分钟收不到经纬度,应用被挂起问题及解决方案

来源:程序员人生   发布时间:2016-07-29 15:54:38 阅读次数:2505次

原来定位服务是10分钟收不到定位信息就挂起定位,现在变成最短3分钟,估计都是为了省电吧。只要你开启利用的后台定位,并且10分钟有1次定位,那末苹果就不会关闭你的线程,现在变成3分钟。若你的利用开启了后台定位,当最短3分钟(经过测试也可能大于3分钟小于等于10分钟)不定位,ios系统也会把你的利用挂起。而高德地图ios sdk的ios9以上版本后台定位开启方法变更,而高德导航库没有同步变更,致使使用老的地图库和高德导航地图库的用户定位服务不能实际开启,切换到后台3分钟(经过测试也可能大于3分钟小于等于10分钟)没有实际定位要求,被ios系统认为是伪定位服务的利用并挂起线程。而高德定位模块也有问题,有时间也有不定位的情况。如:手机开启后台定位的利用,网络连接wifi(aibinjian)切换到后台,当用户移动到wifi覆盖区外,那末利用收到网络异常通知,手机的网络自动切换到4g手机网络,利用没有收到网络正常通知,致使利用在8分钟后不定位,并且利用被系统干掉。当手机没有网络时高德也不定位,而原生态的定位在有网和无网络的情况下都能定位,所以还是用原生态的定位更靠谱。 
高德地图iOS SDK V2.5.0版本提供后台延续定位的能力,即使你的app退到后台,且位置不变动时,也不会被系统挂起,可持久记录位置信息。该功能适用于记录轨迹录或出行类App司机端。

只需要您的做以下几步操作:

1.添加代码。

对iOS9之前的系统:


_mapView.pausesLocationUpdatesAutomatically = NO; 
对iOS9(含)以上系统:


_mapView.allowsBackgroundLocationUpdates = YES;

若你的利用有3D地图和导航地图,那末你的利用用的应当是导航地图,若想用定位由于导航地图没有更新,估计你的利用没有allowsBackgroundLocationUpdates 这个属性,只能让你忧愁了。

高德导航地图库千呼万换始终不出来,需要后台定位服务的利用不可能等待这个大爷吧!只能用替换方案了。开启原生态的定位服务,只是不用原生态的位置,能够保证高德地图1致获得到经纬度,仍旧用高德的经纬。原生态的位置服务只是触发高德地图收到经纬度和保持后台定位。

<code class="hljs objectivec has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"> <span class="hljs-class" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">@interface</span> <span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">mainViewController</span>()<<span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">NoticeCarViewDelegate</span>,<span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">UIAlertViewDelegate</span>,<span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">ServicingViewDelegate</span>,<span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">MAMapViewDelegate</span>,<span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">AMapSearchDelegate</span>,<span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">UIActionSheetDelegate</span>,<span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">PlaceSearchDeleagte</span>,<span class="hljs-title" style="box-sizing: border-box; color: rgb(102, 0, 102);">CLLocationManagerDelegate</span>></span> { CLLocationManager *_locationManager; } - (<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">void</span>)initAMapProperty { FLDDLogDebug(@<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"函数"</span>); _locationManager = [[CLLocationManager alloc] init]; _locationManager<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.delegate</span> = <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">self</span>; _locationManager<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.pausesLocationUpdatesAutomatically</span> = <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">NO</span>; <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">if</span> (IOS_VERSION_LARGE_OR_EQUAL(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">9.0</span>)) { _locationManager<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.allowsBackgroundLocationUpdates</span> = <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">YES</span>; } <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">if</span> (![CLLocationManager locationServicesEnabled]) { <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">NSLog</span>(@<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"定位服务当前可能还没有打开,请设置打开!"</span>); <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">return</span>; } <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//如果没有授权则要求用户授权</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">if</span> ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) { [_locationManager requestAlwaysAuthorization]; } <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">else</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">if</span>([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedAlways) { <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//设置代理</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// _locationManager.delegate = self;</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//设置定位精度</span> _locationManager<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.desiredAccuracy</span> = kCLLocationAccuracyBest; <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//定位频率,每隔多少米定位1次</span> CLLocationDistance distance = <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10.0</span>;<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//10米定位1次</span> _locationManager<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.distanceFilter</span> = distance; <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//启动跟踪定位</span> [_locationManager startUpdatingLocation]; FLDDLogDebug(@<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"开启定位"</span>); } <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// //定位</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// _mapView.showsUserLocation = YES;</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//地图随着位置和方向移动</span> [_mapView setUserTrackingMode:MAUserTrackingModeFollow animated:<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">YES</span>]; _mapView<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.showsCompass</span> = <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">NO</span>; <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//楼块隐藏</span> _mapView<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.buildingsDisabled</span>=<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">YES</span>; <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// //后台定位 可持久记录位置信息。高德地图iOS SDK V2.5.0版本提供后台延续定位的能力,即使你的app退到后台,且位置不变动时,也不会被系统挂起,可持久记录位置信息。该功能适用于记轨迹录或出行类App司机端。</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// if (IOS_VERSION_LARGE_OR_EQUAL(9)) {</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// _mapView.allowsBackgroundLocationUpdates = YES;</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// }</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// else</span> { <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//由于IOS9中定位的授权机制改变 需要进行手动授权</span> _mapView<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.pausesLocationUpdatesAutomatically</span> = <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">NO</span>; } <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//不能旋转</span> _mapView<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.rotateEnabled</span>=<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">NO</span>; _mapView<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.distanceFilter</span> = DISTANCE_FILTER; <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// _mapView.desiredAccuracy = kCLLocationAccuracyHundredMeters;</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// mapView.showsScale = YES;</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// [mapView setZoomLevel:KmaxLEVEL animated:NO];</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//自定义精度圈样式 去除精度圈</span> _mapView<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.delegate</span> = <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">self</span>; <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//纪录经纬度的数组</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// coordates = [[NSMutableArray alloc] init];</span> } <span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">#pragma mark 定位回调 能获得到定位点的经纬度坐标</span> - (<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">void</span>)locationManager:(CLLocationManager *)manager didUpdateLocations:(<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">NSArray</span><CLLocation *> *)locations { [locations enumerateObjectsUsingBlock:^(CLLocation * _Nonnull obj, NSUInteger idx, <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">BOOL</span> * _Nonnull stop) { FLDDLogDebug(@<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"obj.coordinate = %.f \n %.f"</span>,obj<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.coordinate</span><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.latitude</span>,obj<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.coordinate</span><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">.longitude</span>); }]; FLDDLogDebug(@<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">""</span>); } </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li><li style="box-sizing: border-box; padding: 0px 5px;">50</li><li style="box-sizing: border-box; padding: 0px 5px;">51</li><li style="box-sizing: border-box; padding: 0px 5px;">52</li><li style="box-sizing: border-box; padding: 0px 5px;">53</li><li style="box-sizing: border-box; padding: 0px 5px;">54</li><li style="box-sizing: border-box; padding: 0px 5px;">55</li><li style="box-sizing: border-box; padding: 0px 5px;">56</li><li style="box-sizing: border-box; padding: 0px 5px;">57</li><li style="box-sizing: border-box; padding: 0px 5px;">58</li><li style="box-sizing: border-box; padding: 0px 5px;">59</li><li style="box-sizing: border-box; padding: 0px 5px;">60</li><li style="box-sizing: border-box; padding: 0px 5px;">61</li><li style="box-sizing: border-box; padding: 0px 5px;">62</li><li style="box-sizing: border-box; padding: 0px 5px;">63</li><li style="box-sizing: border-box; padding: 0px 5px;">64</li><li style="box-sizing: border-box; padding: 0px 5px;">65</li><li style="box-sizing: border-box; padding: 0px 5px;">66</li><li style="box-sizing: border-box; padding: 0px 5px;">67</li><li style="box-sizing: border-box; padding: 0px 5px;">68</li><li style="box-sizing: border-box; padding: 0px 5px;">69</li><li style="box-sizing: border-box; padding: 0px 5px;">70</li><li style="box-sizing: border-box; padding: 0px 5px;">71</li><li style="box-sizing: border-box; padding: 0px 5px;">72</li><li style="box-sizing: border-box; padding: 0px 5px;">73</li><li style="box-sizing: border-box; padding: 0px 5px;">74</li><li style="box-sizing: border-box; padding: 0px 5px;">75</li><li style="box-sizing: border-box; padding: 0px 5px;">76</li><li style="box-sizing: border-box; padding: 0px 5px;">77</li><li style="box-sizing: border-box; padding: 0px 5px;">78</li><li style="box-sizing: border-box; padding: 0px 5px;">79</li><li style="box-sizing: border-box; padding: 0px 5px;">80</li><li style="box-sizing: border-box; padding: 0px 5px;">81</li><li style="box-sizing: border-box; padding: 0px 5px;">82</li><li style="box-sizing: border-box; padding: 0px 5px;">83</li><li style="box-sizing: border-box; padding: 0px 5px;">84</li><li style="box-sizing: border-box; padding: 0px 5px;">85</li><li style="box-sizing: border-box; padding: 0px 5px;">86</li><li style="box-sizing: border-box; padding: 0px 5px;">87</li><li style="box-sizing: border-box; padding: 0px 5px;">88</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li><li style="box-sizing: border-box; padding: 0px 5px;">50</li><li style="box-sizing: border-box; padding: 0px 5px;">51</li><li style="box-sizing: border-box; padding: 0px 5px;">52</li><li style="box-sizing: border-box; padding: 0px 5px;">53</li><li style="box-sizing: border-box; padding: 0px 5px;">54</li><li style="box-sizing: border-box; padding: 0px 5px;">55</li><li style="box-sizing: border-box; padding: 0px 5px;">56</li><li style="box-sizing: border-box; padding: 0px 5px;">57</li><li style="box-sizing: border-box; padding: 0px 5px;">58</li><li style="box-sizing: border-box; padding: 0px 5px;">59</li><li style="box-sizing: border-box; padding: 0px 5px;">60</li><li style="box-sizing: border-box; padding: 0px 5px;">61</li><li style="box-sizing: border-box; padding: 0px 5px;">62</li><li style="box-sizing: border-box; padding: 0px 5px;">63</li><li style="box-sizing: border-box; padding: 0px 5px;">64</li><li style="box-sizing: border-box; padding: 0px 5px;">65</li><li style="box-sizing: border-box; padding: 0px 5px;">66</li><li style="box-sizing: border-box; padding: 0px 5px;">67</li><li style="box-sizing: border-box; padding: 0px 5px;">68</li><li style="box-sizing: border-box; padding: 0px 5px;">69</li><li style="box-sizing: border-box; padding: 0px 5px;">70</li><li style="box-sizing: border-box; padding: 0px 5px;">71</li><li style="box-sizing: border-box; padding: 0px 5px;">72</li><li style="box-sizing: border-box; padding: 0px 5px;">73</li><li style="box-sizing: border-box; padding: 0px 5px;">74</li><li style="box-sizing: border-box; padding: 0px 5px;">75</li><li style="box-sizing: border-box; padding: 0px 5px;">76</li><li style="box-sizing: border-box; padding: 0px 5px;">77</li><li style="box-sizing: border-box; padding: 0px 5px;">78</li><li style="box-sizing: border-box; padding: 0px 5px;">79</li><li style="box-sizing: border-box; padding: 0px 5px;">80</li><li style="box-sizing: border-box; padding: 0px 5px;">81</li><li style="box-sizing: border-box; padding: 0px 5px;">82</li><li style="box-sizing: border-box; padding: 0px 5px;">83</li><li style="box-sizing: border-box; padding: 0px 5px;">84</li><li style="box-sizing: border-box; padding: 0px 5px;">85</li><li style="box-sizing: border-box; padding: 0px 5px;">86</li><li style="box-sizing: border-box; padding: 0px 5px;">87</li><li style="box-sizing: border-box; padding: 0px 5px;">88</li></ul>

现在高德地图终究发布了新的支持ios9系统后台定位的导航地图包,并且发布了高德地图定位模块,支持1次定位的功能,能够1次定位到你的位置信息和cityCode。但是还存在利用在后台无网络不定位的可能被系统干掉的情况,建议仍旧ios原生定位的功能吧。

ios9.1以后,为了省电,利用切换到后台8分钟,不论是否是开启了后台定位服务,只要没有网络活动都有可能被挂起。所以你的利用切换到后台要保证8分钟以内有1次网络活动(如心跳等)。若用户打开利用去打电话,不知道网络没有了,等打10多分钟的电话,再去看利用,结果利用早挂了,这个问题很坑爹,暂时没有找到缘由。不知道是高德定位弄的鬼还是最新的iphone系统的问题。估计是高德地图问题多些!

生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生