AFNetworking获取服务端plist文件,XML文件
2015-06-30 00:19
441 查看
本人向来不喜欢啰嗦,只喜欢简单粗暴,上代码!!! 注意:你需要下载一个开源的AFNetworking包,版本很多,本人提供一个网盘下载地址: http://pan.baidu.com/s/1jGzmyea 请速度收藏
NSString *urlString=@"http://127.0.0.1:8080/app/test.plist"; NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [AFPropertyListRequestOperation addAcceptableContentTypes:[NSSet setWithObject:@"application/xml"]]; AFPropertyListRequestOperation *operation = [AFPropertyListRequestOperation propertyListRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id propertyList) {// NSLog(@" - - - - - - - - - - %@ - - —!__!_!_!_!_",[propertyList class]); [arrList removeAllObjects]; if ([propertyList isKindOfClass:[NSArray class]]) { NSArray *arr=(NSArray *)propertyList; [arrList addObjectsFromArray:arr]; [table reloadData]; } [table headerEndRefreshing]; }failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id propertyList) { NSLog(@"!!!!! %@",error); [table headerEndRefreshing]; }]; [operation start];
相关文章推荐
- POJ 3592 强连通缩点+spfa最长路
- 公安项目项目感想
- 注解开发spring-aop 入门
- 2015062909 - 黑鹰坠落
- .Net 自定义事件
- .Net 自定义事件
- 第八十八天 how can I 坚持 angelaJs
- 三范式
- 37条常用Shell命令
- virtualtree 的使用(Delphi)
- 2015062908 - EffactiveJava笔记 - 第46条 foreach优先传统for循环(4)
- delphi中VirtualStringTree树使用方法之终结篇!
- Java enum的用法详解
- PHP文件包含漏洞详解
- Eclipse快捷键
- .Net学习笔记----2015-06-29(多态----接口)
- Python学习笔记 - 高阶函数
- Python学习笔记 - 高阶函数
- hdu 2010 及动态分配数组
- [Java]学习笔记,随笔【六】