iOS8 定位失敗問題

時間:2014-10-10post

今天在開發的時候發現了一個iOS8的定位問題。運行操做以後,不會調用到定位以後的delegate方法中,而後我查看了一下手機上相應用的定位權限界面,發現個人應用的訪問用戶的地理位置的權限是空的。以後查了相關信息,獲得下面解決方式:.net

1. Appdelegate中:
    code

CLLocationManager *locationManager;
[UIApplication sharedApplication].idleTimerDisabled = TRUE;
    locationmanager = [[CLLocationManager alloc] init];
    [locationmanager requestAlwaysAuthorization];        //NSLocationAlwaysUsageDescription
    [locationmanager requestWhenInUseAuthorization];     //NSLocationWhenInUseDescription
    locationmanager.delegate = self;

2. 在 info.plist裏增長:
    NSLocationWhenInUseDescription,贊成在前臺獲取GPS的描寫敘述
    NSLocationAlwaysUsageDescription,贊成在後臺獲取GPS的描寫敘述

  例如如下圖:blog

加入以上內容以後即可以進行定位服務,百度地圖和高德地圖也是這種問題。ip

推薦文章:http://blog.csdn.net/yongyinmg/article/details/39521523
開發

相關文章
相關標籤/搜索