安卓与IOS通过hessian接口实现用友系统移动手机订单5苹果手机开发

7 篇文章 0 订阅
7 篇文章 0 订阅
                                            五:苹果手机开发
1:以客户数据为例,在.h文件中声明Delegate,对应hessian服务器端的客户接口,参数要数量一致。
@protocol HesGetCustomerListDelegate <NSObject>
- (NSString *)getCustomerListWithUserID:(NSString *)userID andKeyWords:(NSString *)key andPage:(int )page andPageSize:(int )psize;
@end
2:Delegate方法的声明
@property (nonatomic, strong) id<HesGetCustomerListDelegate> hesContactGetList;
3:需要导入#import "JSON.h"
4:客户数据的获取
        NSException *exp = nil;
        int oldCnt = [arrList count];
        NSURL *url = [NSURL URLWithString:SERV_URL];//SERV_URL和安卓端url是一样的
        NSString *str=@"";
        [CWHessianArchiver setMethodName:@"CustomerList" forSelector:aSelector];
        self.hesContactGetList = (id<HesGetCustomerListDelegate>)[CWHessianConnection proxyWithURL:url
                                                                                         protocol:@protocol(HesGetCustomerListDelegate)];
        @try {
            str = [self.hesContactGetList getCustomerListWithUserID:[[NSUserDefaults standardUserDefaults] valueForKey:UID] andKeyWords:@""
                                                                andPage:curPage andPageSize:pageSize];
        }
        @catch (NSException *exception) {
            exp = exception;
        }
        if (exp) {
            NSLog(@"%@",exp.description);
            [SVProgressHUD showErrorWithStatus:@"获取列表失败" duration:1.6f];
        }
        else {
            NSArray *arr = [str JSONValue];
            [arrList addObjectsFromArray:arr];
        }
    arrList 里边就包含客户的数据。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值