使用聚合数据(juhe.cn)提供的SDK,下载地址:http://www.juhe.cn/juhesdk/download
1,将聚合数据SDK(JuheApis.framework)添加到你的程序中来,SDK依赖的包包括:
2,在聚合SDK Framework的JHSDKAPIPath.h文件中找到下面接口宏,以及字典参数。
/* 移动联通基站 */ /** @brief 移动联通基站 -> 移动联通基站定位接口
@param |
mnc |
int |
必填 |
移动基站:0 联通基站:1 默认:0 |
@param |
lac |
int |
必填 |
小区号 |
@param |
cell |
int |
必填 |
基站号 |
@param |
hex |
int |
非必填 |
进制类型,16或者10,默认为10 |
@param |
dtype |
string |
非必填 |
返回的数据格式:json/xml/jsonp,默认json |
@param |
callback |
string |
非必填 |
当选择jsonp格式时必须传递 |
*/
#define kJHAPIS_LBS_JZ_GSM @"juhe.apis.jizhan.gsm" //1、移动联通基站定位
3,在程序中调用方法(将ViewController.m改为.mm)
在调用SDK的文件中添加头文件
#import <JuheApis/JuheAPI.h> #import <JuheApis/JHOpenidSupplier.h> #import <JuheApis/JHSDKAPIPath.h>
@interface ViewController () @end @implementation ViewController //移动联通基站
- (void)viewDidLoad { [super viewDidLoad];
[ [ JHOpenidSupplier shareSupplier] registerJuheAPIKey : 用户申请到的OpenId ] ;
UIButton* beginBtn=[UIButton buttonWithType:UIButtonTypeSystem]; beginBtn.frame=CGRectMake(20,111,280,40); [beginBtn setTitle:@"开始" forState:UIControlStateNormal]; [beginBtn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal]; [beginBtn addTarget:self action:@selector(doTestAction) forControlEvents:UIControlEventTouchUpInside]; [beginBtn setBackgroundImage:[UIImage imageNamed:@"button5"] forState:UIControlStateNormal]; [self.view addSubview:beginBtn];
}
- (void)doTestAction { /* 移动基站 */ [self test:kJHAPIS_LBS_JZ_GSM parameters : @{@"lac":@"17695",@"cell":@"28655"} ] ;
}
- (void)test:(NSString *)path parameters:(NSDictionary *)parameters{ JuheAPI *juheapi = [JuheAPI shareJuheApi]; [juheapi executeWorkWithAPI:path parameters:parameters success:^(id responSEObject){ NSLog(@" successed %@",[responSEObject description]); } failure:^(NSError *error) { NSLog(@" %@",error.description); }]; }
- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }
@end
4,返回数据说明以及错误码说明
API : juhe.apis.jizhan.gsm (宏 : kJHAPIS_LBS_JZ_GSM )
返回字段:
名称 |
|
类型 |
说明 |
error_code |
|
int |
返回码 |
reason |
|
string |
返回说明 |
data |
|
dictionaty |
返回结果集 |
|
LAC |
string |
小区号 |
|
LNG |
string |
基站号 |
|
LNG |
string |
经度 |
|
LNG |
string |
纬度 |
|
0_LNG |
string |
纠偏后的经度(用于google地图显示) |
|
0_LAT |
string |
纠偏后的经度(用于google地图显示) |
|
PRECOSOON |
string |
基站信号覆盖范围 |
|
ADDRESS |
string |
地址 |
错误码:
|
错误码 |
说明 |
|
200801 |
错误的LAC或CELLID |
|
200803 |
查询不到该基站信息 |
5,更多聚合数据SDK接口,访问这里: http://www.juhe.cn/juhesdk/idocs (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|