您的位置:首页 > 移动开发 > IOS开发

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

2013-08-22 16:40 1081 查看
五:苹果手机开发

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 里边就包含客户的数据。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐