草庐IT

Afnetworking

全部标签

iphone - 使用 AFNetworking 库获取 XML 内容

现在我想使用AFNetworking库来获取XML内容,所以我使用这段代码AFXMLRequestOperation*operation=[AFXMLRequestOperationXMLParserRequestOperationWithRequest:requestsuccess:^(NSURLRequest*request,NSHTTPURLResponse*response,NSXMLParser*XMLParser){XMLParser.delegate=self;[XMLParserparse];}failure:nil];[operationstart];我的问题是想知道

ios - AFNetworking 的AFHTTPClient 如何调试http 请求?

我无法让AFNetworking与Web服务成功通信。有没有办法注销(或以其他方式查看)它发送的确切http请求? 最佳答案 你应该看看AFHTTPRequestOperationLogger,它监听操作开始和完成时发送的通知,并以可配置的详细程度将它们注销。 关于ios-AFNetworking的AFHTTPClient如何调试http请求?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/ques

ios - 重定向 block 的 AFNetworking 3.0 迁移

如何更新这个已弃用的函数以使用AFNetworking3.0?AFHTTPRequestOperation*requestOperation=[[AFHTTPRequestOperationalloc]initWithRequest:[NSURLRequestrequestWithURL:[NSURLURLWithString:_URLString]]];[requestOperationsetRedirectResponseBlock:^NSURLRequest*(NSURLConnection*connection,NSURLRequest*request,NSURLRespons

ios - AFNetworking 3.0 查看日志

我以前用AFNetworkActivityLogger打印网络日志,最近更新AFNetworking到3.0,AFNetworkActivityLogger不支持3.0了。那么,当我使用AFNetworking3.0时,如何像以前一样打印日志呢? 最佳答案 如果您使用cocoapods将此行添加到您的Podfile并运行podinstallpod'AFNetworkActivityLogger',git:'https://github.com/AFNetworking/AFNetworkActivityLogger.git',bra

ios - 如何使用 AFNetworking 2 设置 HTTP 请求?

我需要发送普通的HTTP请求(GET)并以text/html格式回答。如何使用AFNetworkin2发送此响应?现在我正在尝试使用NSURLRequest*request=[NSURLRequestrequestWithURL:[NSURLURLWithString:@"https://example.com"]];[selfHTTPRequestOperationWithRequest:requestsuccess:^(AFHTTPRequestOperation*operation,idresponseObject){NSLog(@"JSON:%@",responseObject

ios - AFNetworking 2.0 - 可变 json

我的代码现在看起来像这样NSURL*URL=[NSURLURLWithString:URLForSend];NSURLRequest*request=[NSURLRequestrequestWithURL:URL];AFHTTPRequestOperation*operation=[[AFHTTPRequestOperationalloc]initWithRequest:request];operation.responseSerializer=[AFJSONResponseSerializerserializer];[operationsetCompletionBlockWithSu

ios - 使用 AFNetworking 从 json 本地文件解析数据

是否可以使用AFNetworking而不是SBJSON从本地json文件解析数据? 最佳答案 您不需要为本地JSON使用AFNetworking。您在本地文件中不会有任何与网络相关的优势。NSString*filePath=[[NSBundlemainBundle]pathForResource:jsonFileNameofType:@"json"];NSData*JSONData=[NSDatadataWithContentsOfFile:filePathoptions:NSDataReadingMappedIfSafeerror

ios - 使用 AFNetworking 2 进行 POST 请求时 cocoa 错误 3840

我每次都调用这个函数并返回Cocoa错误3840。我尝试调试并修复它,它在请求时出错,而不是在解析结果时出错我在请求时在失败block中发现了这个错误。ErrorDomain=NSCocoaErrorDomainCode=3840"Theoperationcouldn’tbecompleted.(Cocoaerror3840.)"(JSONtextdidnotstartwitharrayorobjectandoptiontoallowfragmentsnotset.)UserInfo=0x109230960{NSDebugDescription=JSONtextdidnotstartw

ios - AFNetworking 2.2 SSL 固定自签名证书

我想防止我的应用程序/服务器通信受到MITM攻击,因此我尝试设置SSL固定,但我在使用自签名证书使其与AFNetworking2.2一起工作时遇到问题。我认为这主要是我如何生成证书的问题。我首先尝试根据theseinstructions生成自签名证书:生成私钥:sudoopensslgenrsa-des3-outserver.key2048生成签名请求,并在要求提供通用名称时使用域名:sudoopensslreq-new-keyserver.key-outserver.csr生成证书:sudoopensslx509-req-days365-inserver.csr-signkeyser

iphone - UIImageView+AFNetworking 图片请求队列阻塞来自RestKit的其他网络请求

我正在通过创建RKObjectRequestOperation并将它们添加到RestKit的队列来使用RestKit下载数据:RKObjectRequestOperation*operation=[RKobjectRequestOperationWithRequest:requestsuccess:...failure:...];[RKenqueueObjectRequestOperation:operation];那个效果很好。此外,此数据显示在ListView中,其中包含显示相关用户图标的UIImageViews。但是,这些用户图标不是通过RestKit下载的,而是通过底层的AFN