nsurlconnection

NSOperation and NSURLConnection mystified

一世执手 提交于 2019-12-02 03:23:11
I am trying to download multiple images from some server using NSOperation and NSOperationQueue. My main question is what is the difference between the code snippet below, and this link http://www.dribin.org/dave/blog/archives/2009/05/05/concurrent_operations/ , performance wise? I prefer the second solution, because we have a lot more control over the operations, it is a lot cleaner, and if a connection fails you can handle it properly. If I try to download about 300 images from a server with the code below, my app will have a pretty big delay, and if I launch the app, and go to the home

NSOperation and NSURLConnection mystified

醉酒当歌 提交于 2019-12-02 03:20:26
问题 I am trying to download multiple images from some server using NSOperation and NSOperationQueue. My main question is what is the difference between the code snippet below, and this link http://www.dribin.org/dave/blog/archives/2009/05/05/concurrent_operations/, performance wise? I prefer the second solution, because we have a lot more control over the operations, it is a lot cleaner, and if a connection fails you can handle it properly. If I try to download about 300 images from a server with

How to make NSURLConnection file download work?

北慕城南 提交于 2019-12-02 03:09:43
I have a ViewController declared as: @interface DownloadViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> and I want to use NSURLConnection to download files. NSURLConnection simply "doesn't start", the delegate methods don't work (for example connection:didReceiveResponse is never called) . I noticed in some sample code that the class was subclassing NSObject instead of UIViewController . How do I combine it? I want to use ViewController methods but then I can't use NSURLConnection . It's not so easy to find a fully explained example how to download file with

Convert NSURLConnection to NSURLSessionUploadTask example

北战南征 提交于 2019-12-02 01:36:01
Hi everyone and thanks in advance for any help providing in understanding in how to convert some NSURLConnection code into the newer NSURLSession. What I am trying to do is to make a POST request to a server, and send a photo base 64 encoded for the key "photo". Below I have an working example written in NSURLConnection and I will like to convert it into NSURLSession. As I read on the apple documentation from what I understood I should use a Data tasks because in my case it is an image and if it is a larger transfer like a video the I should use Upload tasks. Regarding the upload task I have

A couple users getting NSURLErrorServerCertificateUntrusted

坚强是说给别人听的谎言 提交于 2019-12-02 00:57:40
I've got several hundred users on this enterprise app. I've got 2 which are throwing a NSURLErrorServerCertificateUntrusted and won't talk to the server. I've checked the server and the cert is valid, but that didn't surprise me because this issue only impacts these 2 users. I've had them check date/time on their iPads and they are set correctly and automatically. I've had them connect try through both cell network and a local WiFi hotspots. It seems unlikely these two users are always being targeted by a man in the middle attack. This Question never got an answer and Apple's TN2232 document

How to disable keepalive in NSURLConnection?

不羁岁月 提交于 2019-12-01 23:18:25
问题 Is there any way to force NSURLConnection to not reuse the current persistent connection but to create a new one ? I am trying to defend myself from this known iOS8 keep-alive bug If iOS 8 receives a HTTP response with a Keep-Alive header, it keeps this connection to re-use later (as it should), but it keeps it for more than the timeout parameter of the Keep-Alive header and then when a second request comes it tries to re-use a connection that has been dropped by the server. I am looking for

Set the progress to UIProgressView when upload with NSURLConnection

馋奶兔 提交于 2019-12-01 22:03:39
问题 I'm trying to refresh the progress bar in an UIProgressView for an upload request with NSURLConnection . The goal is to refresh the progress bar while uploading a picture. After several searches, I managed to use the didSendBodyData of my connection delegate to check the progress like this : - (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite { if(

Objective-C / C pulling private key (modulus) from SecKeyRef

我是研究僧i 提交于 2019-12-01 21:55:58
问题 I need a clean way to pull out my servers public key and compare it to local data in order to defend against expiring / renewed keys in the future, but I can't seem to get at the 256 bit key or express it as useful data for comparison... Here's what I have so far... -(BOOL)trustCertFromChallenge:(NSURLAuthenticationChallenge *)challenge { SecTrustResultType trustResult; SecTrustRef trust = challenge.protectionSpace.serverTrust; OSStatus status = SecTrustEvaluate(trust, &trustResult); NSString

How to disable keepalive in NSURLConnection?

£可爱£侵袭症+ 提交于 2019-12-01 21:32:26
Is there any way to force NSURLConnection to not reuse the current persistent connection but to create a new one ? I am trying to defend myself from this known iOS8 keep-alive bug If iOS 8 receives a HTTP response with a Keep-Alive header, it keeps this connection to re-use later (as it should), but it keeps it for more than the timeout parameter of the Keep-Alive header and then when a second request comes it tries to re-use a connection that has been dropped by the server. I am looking for a way to solve this issue from Objective c rather than solving from server side. If any third party

NSURLConnection timing out on iOS8

[亡魂溺海] 提交于 2019-12-01 19:20:55
I have been working on an application involving client-server communication. Everything was working fine until iOS 7.1. Now that Xcode 6 GM Seed in launched, I tried to build and run the project on iOS8 simulator. However, all NSURLConnections seem to time out now. I can not get any response from the server. This works on iOS 7 simulator and Xcode 6. I tried using the NSURLSession hoping that would resolve the issue. But it hasnt. Any help will be highly appreciated!! If anyone else has faced this issue, please let me know if you have any workaround to this. UPDATE : This is the code I have