afnetworking-2

How to use Progress parameter in AFNetworking 2.0

依然范特西╮ 提交于 2019-12-18 04:03:36
问题 I am trying to use AFNetworking 2.0 with NSURLSession. I am using the method - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromFile:(NSURL *)fileURL progress:(NSProgress * __autoreleasing *)progress completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler; How am I supposed to use the progress parameter. The method is a non blocking method. Hence I will have to listen to the ' progress ' to get the updates. But the

Post Request with AFHttpRequestOperationManager not working

我的未来我决定 提交于 2019-12-18 03:57:25
问题 I am using AFHTTPRequestOperationManager to post some JSON to my server, my code is below. NSDictionary *parameters = [[NSDictionary alloc] initWithObjectsAndKeys:@"john", @"name", @"xxxxx@gmail.com", @"email", @"xxxx", @"password", @"1", @"type", nil]; // Do any additional setup after loading the view. AFSecurityPolicy *policy = [[AFSecurityPolicy alloc] init]; [policy setAllowInvalidCertificates:YES]; AFHTTPRequestOperationManager *operationManager = [AFHTTPRequestOperationManager manager];

Does AFNetworking 2.0 support iOS 6.0?

早过忘川 提交于 2019-12-18 03:32:34
问题 AFNetworking 2.0 was announced last week. But I find different requirements for AFNetworking 2.0. README.md tells it requires either iOS 7.0 and above, while AFNetworking 2.0 Migration Guide tells it requires either iOS 6.0 and above. Dose AFNetworking 2.0 support iOS 6.0? 回答1: Accoding to the CocoaPods podspec, you can simply use AFN 2.0 but not include the NSURLSession related files. For example if you use CocoaPods (if you don't, you should really consider doing it, it's awesome!), simply

Replacement for AFJSONRequestOperation in AFNetworking 2.x

南笙酒味 提交于 2019-12-17 23:27:35
问题 I am making a basic iPhone app with HTML Requests, by following this tutorial. The tutorial has me using AFJSONRequestOperation in AFNetworking. The trouble is, I'm using AFNetworking version 2, which no longer has AFJSONRequestOperation. So, of course, this code (from about half-way down the tutorial, under the heading " Querying the iTunes Store Search API ") doesn't compile: NSURL *url = [[NSURL alloc] initWithString: @"http://itunes.apple.com/search?term=harry&country=us&entity=movie"];

Wanted: Up-to-date example for JSON/POST with basic auth using AFNetworking-2

懵懂的女人 提交于 2019-12-17 22:36:49
问题 I have a toy app which submits an https JSON/POST using basic auth security. I've been told I should consider using AFNetworking. I've been able to install AFNetwork-2 into my XCode project (ios7 target, XCode5) just fine. But none of the examples out there seem to be relevant to current versions of AFNetworking-2, but rather previous versions. The AFNetworking docs are pretty sparse, so I'm struggling how to put the pieces together. The non-AFNetworking code looks something like: NSURL *url

Posting JSON data using AFNetworking 2.0

江枫思渺然 提交于 2019-12-17 06:27:38
问题 I have a web script which accepts JSON string as input through HTTP POST request. I have came across several AFNetworking 1.x example for the same , can anybody please point me or give AFNetworking 2.0 example to do an HTTP POST request to a web script with formatted JSON as input ? Thanks 回答1: after searching docs and trying out some codes I got following as an example AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.requestSerializer =

AFNetworking 2 - get error json body [duplicate]

微笑、不失礼 提交于 2019-12-14 03:53:33
问题 This question already has answers here : AFNetworking 2.0 Get JSON from code 400 in failure block (4 answers) Closed 4 years ago . I'm using latest AFNetworking for my app which speaks with REST API server. When I get some 500 error from it with JSON body something like { "message": "my error message" } , I cannot retrieve this message from NSError which lib responds to me: [api setupUser:data success:^(AFHTTPRequestOperation *operation, id responseObject) { // some success handle } failure:^

AFNetworking error in uploadTaskWithStreamedRequest

半腔热情 提交于 2019-12-14 03:44:39
问题 Error Terminating app due to uncaught exception 'NSGenericException', reason: 'Upload tasks in background sessions must be from a file' when i try NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; configuration for NSURLSession work fine but when i use bellow configuration then application crash and give me error. NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:kBackgroundSessionIdentifier];

AFNetworking 2 and background tasks

我只是一个虾纸丫 提交于 2019-12-14 02:39:51
问题 I have a question about AFNetworking 2 and background downloads/uploads thanks to the new iOS7 NSURLSession background requests Is this automatically handled by my AFHTTPRequestOperationManager ? Does it automatically set my requests'session to background mode? I saw that the AFURLSessionManager Has a setDidFinishEventsForBackgroundURLSessionBlock Method but I wonder if everything is automatic? If my app is killed or suspended, will requests keep on going? How can I get a callback when my app

AFNetworking 2.0 “_NSURLSessionTransferSizeUnknown” linking error on Mac OS X 10.8

心已入冬 提交于 2019-12-13 04:34:20
问题 I'm using AFNetworking 2.0 Mac OS X 10.8.0 Xcode 5 But I'm receiving the following error: Undefined symbols for architecture x86_64: "_NSURLSessionTransferSizeUnknown", referenced from: -[AFURLSessionManagerTaskDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:] in AFURLSessionManager-C493EEE75215474B.o -[AFURLSessionManager uploadTaskWithTask:progress:completionHandler:] in AFURLSessionManager-C493EEE75215474B.o ld: symbol(s) not found for architecture x86_64