聚合数据iOS SDK 移动联通基站(GSM)演示示例

使用聚合数据(juhe.cn)提供的SDK,下载地址:http://www.juhe.cn/juhesdk/download


1,将聚合数据SDK(JuheApis.framework)添加到你的程序中来,SDK依赖的包包括:



2,在聚合SDK Framework的JHSDKAPIPath.h文件中找到下面接口宏,以及字典参数。

/* 移动联通基站 */
/**
 @brief 移动联通基站 -> 移动联通基站定位接口

@param mncint必填移动基站:0 联通基站:1 默认:0
@param lacint必填小区号
@param cellint必填基站号
@param hexint非必填进制类型,16或者10,默认为10
@paramdtypestring非必填返回的数据格式:json/xml/jsonp,默认json
@paramcallbackstring非必填当选择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,返回数据说明以及错误码说明


返回字段:

名称

 

类型

说明

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

错误LACCELLID

 

200803

查询不到基站信息

  

5, 更多聚合数据SDK接口,访问这里: http://www.juhe.cn/juhesdk/idocs

转载于:https://my.oschina.net/u/2009908/blog/325568

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值