草庐IT

lPods-AFNetworking

全部标签

ios - 如何使用 AFNetworking 2.0 上传二进制数据

我正在寻找一种方法来执行此操作curl-uusername:password-H"Content-Type:application/binary"\--data-binary@file.dat-XPOST\"https://helpdesk.zendesk.com/api/v2/uploads.json?filename=myfile.dat&token={optional_token}"我试过用这个[afnetworkmanagerPOST:urlparameters:nilconstructingBodyWithBlock:^(idformData){[formDataappend

ios - 来自 Afnetworking 的大图像缓存

我正在使用AFNetworking从Internet下载一些图像到我的应用程序。我正在使用此代码下载这些图像,AFHTTPRequestOperation*requestOperation=[[AFHTTPRequestOperationalloc]initWithRequest:[NSURLRequestrequestWithURL:[NSURLURLWithString:_linkString[indexPath.item]]]];requestOperation.responseSerializer=[AFImageResponseSerializerserializer];[r

iphone - AFNetworking with CoreData 线程安全吗?

我在我的iPhone应用程序中遇到间歇性的、难以重现的错误,所以我正在检查我对并发性的假设。运行AFNetworkingv0.10.x,我有以下网络调用:[selfpostPath:@"/myEndPoint"parameters:paramssuccess:^(AFHTTPRequestOperation*request,idresponse){AppDelegate*appDelegate=(AppDelegate*)[[UIApplicationsharedApplication]delegate];//dostuffwithobjectcontexthere[appDelega

ios - CFNetwork SSLHandshake 因 AFNetworking 2.0、自签名 cer 和 [policy setAllowInvalidCertificates :YES] 而失败

我正在使用AFNetworking2。我的项目Bundle中有一个自签名根CA证书我允许无效证书:[policysetAllowInvalidCertificates:YES];我的网址是https://因此,理论上应该接受自签名证书。AFSecurityPolicyAFSecurityPolicy*policy=[AFSecurityPolicypolicyWithPinningMode:AFSSLPinningModeNone];[policysetAllowInvalidCertificates:YES];AFHTTPRequestOperationManagerAFHTTPRe

ios - 用于 JSON 解析的 AFNetworking 出错

我有以下用于JSON解析的代码:NSURLRequest*request=[NSURLRequestrequestWithURL:[NSURLURLWithString:@"https://www.dropbox.com/s/qz16qyi3julygl9/facebook.json"]];AFJSONRequestOperation*operation=[AFJSONRequestOperationJSONRequestOperationWithRequest:requestsuccess:^(NSURLRequest*request,NSHTTPURLResponse*respon

ios - 无法在 AFNetworking 2 中使用自签名证书

我把ApacheServer使用的.cer证书放到了Xcode工程中。当应用程序尝试与服务器通信时,我在Xcode中收到此错误:AssertionfailureinidAFPublicKeyForCertificate(NSData*__strong)(),/Users/../ProjectName/AFNetworking/AFSecurityPolicy.m:52***Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'Invalidparameternotsatisfying

ios - 编译单元测试时找不到 -lPods-test clang 的库

我正在尝试运行我的单元测试,但出现以下错误:ld:librarynotfoundfor-lPods-testclang:error:linkercommandfailedwithexitcode1(use-vtoseeinvocation)Ld/Users/AUSER/Library/Developer/Xcode/DerivedData/MYIOSPROJProject-cmxbzcbzjfbvgncspsalqnjvlova/Build/Products/Debug-iphonesimulator/MYIOSPROJProjectTests.xctest/MYIOSPROJProj

ios - 如何从 AFnetworking 2.0 操作/NSURLSessioNDataTask 获取原始 JSON 响应?

这是我的代码..它是一个非常简单的操作[selfGET:operationNameparameters:paramssuccess:^(NSURLSessionDataTask*task,idresponseObject){NSLog(@"%@",responseObject);//dosomethinguponsuccess}}failure:^(NSURLSessionDataTask*task,NSError*error){//dosomethingtohandleerror}];我的问题是,我需要查看确切的原始json响应是什么。当我对responseObject进行NSLog

ios - 嵌套 json 中的 AFNetworking 帖子图像

我必须发送一个嵌套的json请求,其中在内部层次结构中包含一个图像。例如:{"product":{"catalogue_id":"x","name":"myproduct","image":#}}问题是,如果我尝试使用multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:(和appendPartWithFileData:name:fileName:mimeType:),将catalogue_id和名称作为参数传递,图像字段附加在“产品”之后,如下所示:{"product":{"catalogue

objective-c - AFNetworking 错误 URL

我在这里遇到了一个奇怪的问题,很惊讶我没有发现其他人遇到同样的问题。我正在使用AFNetworking创建一个AFJSONRequestOperation。它在第一次建立网络连接时工作。但是,一旦建立网络连接,相同的代码就会失败并显示“BadURL”错误。奇怪的是,该应用程序在失败之前甚至从未对服务器执行ping操作,我正在使用Charles嗅探所有请求。有没有人遇到过这种情况?供引用,这里是代码:NSURL*url=[NSURLURLWithString:JOIN_URL];AFHTTPClient*httpClient=[[AFHTTPClientalloc]initWithBas