您好,登錄后才能下訂單哦!
1,將聚合數據SDK(JuheApis.framework)添加到你的程序中來,SDK依賴的包包括:
2,在聚合SDK Framework的JHSDKAPIPath.h文件中找到快遞查詢接口宏,以及字典參數
/*** 常用快遞 ***/
/**
@brief 常用快遞 -> 常用快遞查詢API
@param com string 是 需要查詢的快遞公司編號
@param no string 是 需要查詢的訂單號
@param dtype string 否 返回數據的格式,xml或json,默認json
*/
#define kJHAPIS_LIFE_EXP_INDEX @"juhe.apis.exp.index" //1、常用快遞查詢API
/**
@brief 常用快遞 -> 快遞公司編號對照表
*/
#define kJHAPIS_LIFE_EXP_COM @"juhe.apis.exp.com" //2、快遞公司編號對照表
3,快遞查詢接口在程序中調用方法(將ViewController.m改為.mm)
#import "ViewController.h"
#import <JuheApis/JuheAPI.h>
#import <JuheApis/JHOpenidSupplier.h>
#import <JuheApis/JHSDKAPIPath.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[[JHOpenidSupplier shareSupplier] registerJuheAPIByOpenId:@"申請到的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 p_w_picpathNamed:@"button5"] forState:UIControlStateNormal];
[self.view addSubview:beginBtn];
}
- (void)doTestAction
{
// /* 常用快遞 */
[self test:kJHAPIS_LIFE_EXP_INDEX parameters:@{@"com":@"sf" , @"no":@"575677355677"}];
[self test:kJHAPIS_LIFE_EXP_COM parameters:@{}];
}
- (void)test:(NSString *)path parameters:(NSDictionary *)parameters{
JuheAPI *juheapi = [JuheAPI shareJuheApi];
[juheapi executeWorkWithAPI:path
parameters:parameters
success:^(id responseObject){
if ([[parameters objectForKey:@"dtype"] isEqualToString:@"xml"]) {
NSLog(@"***xml*** \n %@", responseObject);
}else{
int error_code = [[responseObject objectForKey:@"error_code"] intValue];
if (!error_code) {
NSLog(@" %@", responseObject);
}else{
NSLog(@" %@", responseObject);
}
}
} failure:^(NSError *error) {
NSLog(@"error: %@",error.description);
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
4,快遞查詢接口返回數據說明以及錯誤碼說明
4.1 API :juhe.apis.exp.index (宏:kJHAPIS_LIFE_EXP_INDEX)
返回字段:
4.2 API :juhe.apis.exp.com(宏:kJHAPIS_LIFE_EXP_COM)
返回字段:
5, 更多聚合數據SDK接口,訪問這里: http://www.juhe.cn/juhesdk/idocs
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。