Rumah > Soal Jawab > teks badan
注:百度地图iOS SDK向广大开发者提供了配置更简单的 .framework形式的开发包。自v2.9.0起,百度地图iOS SDK将不再提供 .a形式的开发包。
.framework的怎么用,官网上看不懂。
http://lbsyun.baidu.com/index.php?title=iossdk/theupdatelog
PHPz2017-04-17 18:01:58
Susulan operasi rasmi, ia tidak berjaya Berikut adalah pengalaman saya yang berjaya sebulan yang lalu, sila rujuk:
Anggap anda sudah mempunyai akaun pembangunan dan permohonan permohonan telah diluluskan.
1. Sesuaikan dan muat turun pakej asas peta baidu Selepas membuka zip, salin BaiduMapAPI_*.rangka kerja ke direktori akar folder projek.
2. Sifat projek, Fasa Bina >
Pautkan binari dengan perpustakaan, tambah:
BaiduMapAPI_Base.framework;
BaiduMapAPI_Map.framework;
CoreGraphics.framework;
CoreLocation.framework;
CoreTelephony.framework;
Security.framework;
SystemConfiguration.framework;
OpenGLES.framework;
QuartzCore.framework;
libsqlite3.0.tbd;
libstdc++.6.0.9.tbd;
3. Sifat Projek, Tetapan Bina >
3.1 Langkah ini tidak mengikut dokumentasi rasmi Baidu, pastikan "Mengikut Jenis Fail" tidak berubah
3.2 Memautkan >
BaiduMapAPI_Map.framework/Resources/mapapi.bundle
Akses 5.1 https
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Pengecam himpunan 5.2:
<key>CFBundleDisplayName</key>
<string>HelloBaiduMap</string>
6. Kod:
//
// AppDelegate.h
// HelloBaiduMap
//
// Created by Jeffrey Zhang on 16/3/25.
// Copyright © 2016年 Jeffrey Zhang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <BaiduMapAPI_Base/BMKBaseComponent.h>//引入base相关所有的头文件
#import <BaiduMapAPI_Map/BMKMapComponent.h>//引入地图功能所有的头文件
//#import <BaiduMapAPI_Map/BMKMapView.h>//只引入所需的单个头文件
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) BMKMapManager *mapManager;
@end
//
// AppDelegate.m
// HelloBaiduMap
//
// Created by Jeffrey Zhang on 16/3/25.
// Copyright © 2016年 Jeffrey Zhang. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
_mapManager = [[BMKMapManager alloc]init];
// 如果要关注网络及授权验证事件,请设定 在此处输入您的授权Key , generalDelegate参数
BOOL ret = [_mapManager start:@"8CxxxxxxxxxxxxxxxxxxxxL" generalDelegate:nil];
if (!ret) {
NSLog(@"manager start failed!");
}
return YES;
}
//
// ViewController.m
// HelloBaiduMap
//
// Created by Jeffrey Zhang on 16/3/25.
// Copyright © 2016年 Jeffrey Zhang. All rights reserved.
//
#import "ViewController.h"
#import <BaiduMapAPI_Base/BMKBaseComponent.h>//引入base相关所有的头文件
#import <BaiduMapAPI_Map/BMKMapComponent.h>//引入地图功能所有的头文件
@interface ViewController ()
@end
@implementation ViewController
-(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
BMKMapView *mapView = [[BMKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
self.view = mapView;
}
[Soalan Lazim]permulaan pengurus gagal: Nama paparan himpunan mesti ditambahkan pada info.plist