1. 程式人生 > >iOS 使用騰訊地圖顯示用戶位置註意事項

iOS 使用騰訊地圖顯示用戶位置註意事項

nag rgb system current info cti iap level zoom

1. 向 target中info 加入 NSLocationWhenInUseUsageDescription,string 類型。值是描寫敘述為什麽須要用戶位置,這句話會出如今 提示用戶是否同意app訪問用戶位置提示框中。

2. 在appdelegate.m 的 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
中加入

//地圖定位

CLLocationManager* locationManager = [[

CLLocationManageralloc] init];

if ([[UIDevicecurrentDevice].systemVersionfloatValue] >= 8.0) {

[locationManager requestWhenInUseAuthorization];

}

3. 加入騰訊地圖

self.mapView = [[QMapView alloc] initWithFrame:self.view.frame];

self.mapView.delegate = self;

self

.mapView.showsUserLocation = YES;

//縮放級別

_mapView.zoomLevel =13;

[self.view addSubview:_mapView];



iOS 使用騰訊地圖顯示用戶位置註意事項