afnetworking-2

AFNetworking JSON serialization problems

陌路散爱 提交于 2019-12-13 03:57:36
问题 I'm sending JSON (initially stored in an NSDictionary) using AFNetworking. My object looks like this (taken from a doc comment): /** * Sends a create request to the API server * Success will be a dictionary containing: * * playlistSession: { * "mediaSegments": {}, * "mediaSequence": 0, * "timeElapsed": 0, * "config": { * "maxSegments": 4, * "targetDuration": 10 * }, * "meta": { * "id": "test", * "shouldBeAvailable": false, * "isAvailable": false, * "shouldFinish": false, * "isFinished": false

conflict in return type of the function + IOS

你说的曾经没有我的故事 提交于 2019-12-13 03:04:14
问题 I'm building an iOS app and i'm using AFNetworking library to POST data to the server. I have created a function to post data and calling this function in different classes in my app. I am getting response of the request in the variable called "responseObject" , And i want to return this in the return statement i am not able to identify the return type of responseObject and hence of the function,I tried using NSDictionary but getting following warning: Conflicting return type in

AFHTTPSessionManager block is not called when app is on background

Deadly 提交于 2019-12-13 01:37:26
问题 My app get a silent push, then do some http request in background using AFNetworking,but it didn't enter the complete block, code is: AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] init]; [manager GET:urlString parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) { NSLog(@"response objece:%@", responseObject); } failure:^(NSURLSessionDataTask *task, NSError *error) { NSLog(@"error:%@", error); }]; then I found maybe I could use NSURLSessionConfiguration to

AFNetworking 2.x POST request with xml body

做~自己de王妃 提交于 2019-12-13 01:17:24
问题 I am trying to POST some data to the server with body formatted as XML. [[HttpClientXML sharedClientWithBaseUrl:self.baseUrl] POST:@"/postXml/" parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) { BSLog(@"Success"); } failure:^(NSURLSessionDataTask *task, NSError *error) { BSLog(@"Error: %@",error.localizedDescription); }]; POST body xml content looks smth. like that: <action name='job'>jobName</action> HttpClientXML has this definitions: self.responseSerializer =

Error 1012 when using SSL in AFNetworking 2.0

被刻印的时光 ゝ 提交于 2019-12-12 12:23:51
问题 I'm trying to connect with SSL to my website which is using a certificated signed by StartSSL. When I browse to the website, everything is working fine, however, when I try to use SSL in the app, I get: Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x8d635f0 {NSErrorFailingURLKey=https://edutoets.nl/API/login.php, NSErrorFailingURLStringKey=https://edutoets.nl/API/login.php} I've included the certificate in .cer format

How-to combine AFNetworking 2.0 with reactive cocoa to chain a queue of requests together?

不打扰是莪最后的温柔 提交于 2019-12-12 10:18:11
问题 I have several Requests that depend on each other and must me called in sequence? Can somebody give me an example using AFNetworking and reactive cocoa? Example: LoginRequest (return transactionId) UpdateRequest post data with transactionId UploadRequest jpeg with transactionId EndRequest with transactionId 回答1: The method names are clearly made-up but should give you a sense of the form of the code you'd write: [[self executeLoginRequest] flattenMap:^(id transactionId) { return [[[self

AFNetworking SSL Pinning Expired Certificates

北城以北 提交于 2019-12-12 08:39:42
问题 How do you update expired ssl certificates if ssl pinning is used on ios apps? It seems like only an app update would enable updating the certificate but then users who don't update the app will not receive this update. 回答1: The key is to understand the possible values for AFSecurityPolicy 's pinningMode . AFSSLPinningModeCertificate means that the certificate provided by the server must match exactly one of the pinned certificates, which by default are the certificates in your app bundle.

Auto synthesis error in AFURLRequestSerialization with Xcode 6

亡梦爱人 提交于 2019-12-12 08:00:29
问题 How do I fix the warning "auto property synthesis will not synthesize because it is readwrite but it will be synthesized readonly via another property" for the properties streamStatus and streamError that I'm getting with the latest AFNetworking on the Xcode 6 beta? https://github.com/AFNetworking/AFNetworking/blob/master/AFNetworking/AFURLRequestSerialization.m#L733 Here's the relavent line in AFURLRequestSerialization.m line 733 and 734: @interface AFMultipartBodyStream () <NSCopying>

Upload a .zip file to REST server using AFNetworking fails

主宰稳场 提交于 2019-12-12 04:56:43
问题 From the AFNetworking documentation I get the following code while trying to upload a file in a REST server which with other clients work fine but with my implementation it crashes with Internal Server Error. The code is the following: - (BOOL)uploadFile:(NSString *)path apiKey:(NSString *)apiKey { NSData *symbolsData = [NSData dataWithContentsOfFile:path]; if (!symbolsData) { NSLog(@"Symbols file at %@ does not exist.", path); return NO; } if ([symbolsData length] > 33554432) { NSLog(@

AFNetworking sending NSMutableDictionary as POST

烂漫一生 提交于 2019-12-12 04:34:28
问题 Im new to using AFNetworking. I managed to make GET request work with some help from a nice guy here in stack overflow. Now im stuck in making a POST request. I try this code but i always end up in failed block. How come? -(void) postEventInfo: (NSMutableDictionary *) eventInfoObject{ NSURL *url = [NSURL URLWithString:string]; AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:url]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; manager