iOS 使用騰訊地圖顯示用戶位置註意事項
阿新 • • 發佈:2017-08-06
nag rgb system current info cti iap level zoom
CLLocationManageralloc]
init];
.mapView.showsUserLocation =
YES;
1. 向 target中info 加入 NSLocationWhenInUseUsageDescription,string 類型。值是描寫敘述為什麽須要用戶位置,這句話會出如今 提示用戶是否同意app訪問用戶位置提示框中。
2. 在appdelegate.m 的 - (BOOL)application:(UIApplication
*)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
中加入
//地圖定位
CLLocationManager* locationManager = [[
if ([[UIDevicecurrentDevice].systemVersionfloatValue] >= 8.0) {
[locationManager requestWhenInUseAuthorization];
}
3. 加入騰訊地圖self.mapView = [[QMapView alloc] initWithFrame:self.view.frame];
self.mapView.delegate = self;
self
//縮放級別
_mapView.zoomLevel =13;
[self.view addSubview:_mapView];
iOS 使用騰訊地圖顯示用戶位置註意事項