高德地图使用详解

      1. 访问 http://lbs.amap.com/console/key/。

  1. 注册高德开发者账号,并认证成为开发者。(若已经是开发者,可直接到步骤 3)

  2. 在“KEY 管理”页面点击上方的“获取 key”按钮,依次输入应用名,选择绑定的服务为“iOS 平台 SDK”,输入 Bundle Identifier

  3. 在“相关下载”页面中根据您的需求下载库文件并解压,包括:
    
    • 􏰁  3D矢量地图库,点击下载。解压后得到MAMapKit.framework文件。3D矢量地图效果优,可 查看 3D 楼块,功能全,还支持离线地图,能帮您节省流量。目前暂不支持地图多实例。

    • 􏰁  2D栅格地图库,点击下载。解压后得到MAMapKit.framework文件。2D栅格地图库体积小, 能耗低。支持地图多实例。

    • 􏰁  搜索库,点击下载。解压后得到AMapSearchKit.framework文件。搜索库功能包含:POI查询、 路径规划、地理编码和逆地理编码、公交查询以及输入提示语查询。

      注意:3D 矢量地图和 2D 栅格地图只能选择一个使用,接口类似。 

     

  4. 左侧目录中选中工程名,在 TARGETS->Build Phases-> Link Binary With Libaries 中点击“+”按 钮,在弹出的窗口中点击“Add Other”按钮,选择解压后的 MAMapKit.framework 文件添加到工程中。
  5. 引入系统库 

    UIKit.framework 

    Foundation.framework 

    CoreGraphics.framework 

    OpenGLES.framework 

    SystemConfiguration.framework

    Security.framework

    CoreLocation.framework

    libstdc++.6.0.9.dylib

    libz.dylib

    QuartzCore.framework

    CoreTelephony.framework

  6. 环境配置 

    在 TARGETS->Build Settings->Other Linker Flags 中添加-ObjC。 

    注意:V2.3.0(含)之前版本不支持 arm64,还需在 TARGETS->Build Settings->Architectures 点 出选择框,选择 “Other”,将默认值修改为 $(ARCHS_STANDARD_32_BIT)。

  7. 或者在cocopod下载

    pod 'AMap3DMap' #3D 地图 SDK
    pod 'AMap2DMap' #2D 地 

    pod 'AMapSearch' #搜索服务 SDK 

  8. [MAMapServices sharedServices].apiKey = @"用户 Key"; 

    -(void) viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib. //配置用户 Key
    [MAMapServices sharedServices].apiKey = @"用户 Key";
    _mapView = [[MAMapView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds))];
    _mapView.delegate = self; [self.view addSubview:_mapView];
    }
    -(void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    // Do any additional setup after loading the view, typically from a nib. //配置用户 Key
    [MAMapServices sharedServices].apiKey = @"用户 Key";
    _mapView = [[MAMapView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds))];
    _mapView.delegate = self; [self.view addSubview:_mapView];
    }

     

  9.   具体实现可以下载demo模仿操作。

posted on 2016-08-08 17:42  小豌先生  阅读(1666)  评论(0编辑  收藏  举报

导航