MapxusMapSDK 6.4.0

MapxusMapSDK 6.4.0

mapxus admin 维护。



 
依赖于
MapxusBaseSDK= 6.4.0
MapxusRenderSDK= 5.13.0
 

  • Mapxus

MapxusMapSDK_iOS

1. 关于 Mapxus Map

Mapxus 地图 SDK 是一套室内地图开发调用接口。开发者可以轻松地将地图特征集成到自己的 iOS 应用程序中,包括显示地图、更改地图风格、地图交互、在地图上绘制、搜索建筑、搜索 POI、路线规划等。

1.1 最小 IOS 版本

Mapxus Maps SDK for iOS 部署在 iOS 9 及以上版本。

1.2 获取 API 密钥

请联系我们获取 API 密钥和密钥。

2. 安装 Mapxus Map SDK

首先,请为您应用程序创建一个项目。然后,按照以下步骤集成 SDK。

2.1 自动集成

您可以通过 cocoapods 进行集成。在 Podfile 中添加以下代码:

target 'MapxusMapSample' do
  use_frameworks!
  pod 'MapxusBaseSDK', '~>0.1.1' # you can not write this line, because MapxusMapSDK will
                                 # automatically depends on MapxusBaseSDK
  pod 'MapxusMapSDK', '~> 3.1.1'
end

2.2 手动集成

2.2.1 添加 MapxusMapSDK 及其依赖项

复制拖动 MapxusMapSDK.frameworkMapxusBaseSDK.frameworkAFNetworking.frameworkYYModel.frameworkMapbox.framework 文件到项目文件夹中,并在 常规->嵌入的二进制文件 中添加,如图所示。另外,Mapbox.framework 可以在此处下载:这里

AFNetworking.framework 和 YYModel.framework 也可以通过 cocoapods 或 Carthage 管理,但您必须生成 动态依赖

image

2.2.2 配置您的项目

  1. 如果您需要定位,您需要添加 隐私 - 总是使用位置描述隐私 - 在使用时使用位置描述 作为值以启用定位功能。
  2. 您可以通过 Carthage 的 copy-frameworks 删除 AFNetworking.framework 和 YYModel.framework 的模拟器。按照以下图片配置运行脚本:image

或通过编写 Shell 脚本自行删除。

2.3 创建您的第一个地图

AppDelegate 中注册您的地图

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [[MXMMapServices sharedServices] registerWithApiKey:@"your apiKey" secret:@"your secret"];

    return YES;

}

将您的地图添加到 ViewController(**注意: MGLMapViewdelegate 不允许为 nil **):

#import "SimpleMapViewController.h"
@import Mapbox;
@import MapxusMapSDK;

@interface SimpleMapViewController () <MGLMapViewDelegate>

@property (nonatomic, strong) MGLMapView *mapView;
@property (nonatomic, strong) MapxusMap *map;

@end

@implementation SimpleMapViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = self.nameStr;
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.mapView];
    self.map = [[MapxusMap alloc] initWithMapView:self.mapView];
}

- (void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
    self.mapView.frame = self.view.bounds;
}


- (MGLMapView *)mapView
{
    if (!_mapView) {
        _mapView = [[MGLMapView alloc] init];
        _mapView.centerCoordinate = CLLocationCoordinate2DMake(22.304716516178253, 114.16186609400843);
        _mapView.zoomLevel = 16;
        _mapView.delegate = self;
    }
    return _mapView;
}

@end