nsurlconnection

UIWebView Delegate get MIME Type

这一生的挚爱 提交于 2019-12-03 13:48:04
问题 The UIWebView does not automatically support processing of Passbook .pkpass files. In this technical note, Apple recommend implementing a check via the UIWebViewDelegate methods to sniff out the MIME type and process it accordingly. To add passes using a UIWebView, implement the appropriate UIWebViewDelegate methods to identify when the view loads data with a MIME type of application/vnd.apple.pkpass However, I cannot find anything within the UIWebView Delegate Protocol Reference that is

How to solve timeout issues caused by bad HTTP persistent connection?

纵饮孤独 提交于 2019-12-03 13:19:14
问题 I've been struggling with an HTTP timeout issue recently. After more than one month of investigation I'm quite sure that it is caused by bad HTTP persistent connections. Details are as follows: It is an iOS app. Most users are running iOS 8. I'm using NSURLConnection . iOS 8 has one known keep alive bug but mine is a different issue. More specifically, that bug causes NSURLErrorNetworkConnectionLost but my error is NSURLErrorTimedOut . However, I'm not sure whether my issue is caused by

Handling a NSURLRequest with timeout when using delegate

别来无恙 提交于 2019-12-03 12:57:49
I'm using a NSMutableURLRequest to connect to a web site to get a JSON response. I'm doing so by generating the request, and then using NSURLConnection with a delegate of self to handle the async connection. I've implemented all the normal delegate methods: - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error - (void)connectionDidFinishLoading:(NSURLConnection *)connection All works perfectly with getting data back, dealing with any errors that occur, etc. However with the timeout on

NSURLConnection with blocks

元气小坏坏 提交于 2019-12-03 12:37:13
I'm using [NSURLConnection connectionWithRequest:req delegate:self]; and then I use -(BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace; -(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error; -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response; -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data; -(void

Unable to get destinationURL data in connectionDidFinishDownloading for ios5

余生颓废 提交于 2019-12-03 11:19:45
I'm trying to get a list of assests urls to download. I'm using NSURLConnection in order to get a JSON file that have this list of urls. in - (void)connection:(NSURLConnection *)connection didWriteData:(long long)bytesWritten totalBytesWritten:(long long)totalBytesWritten I'm getting 122239 as total bytes written. when - (void)connectionDidFinishDownloading:(NSURLConnection *)connection destinationURL:(NSURL *)destinationURL is called I'm trying to read the url data in order to extract the JSON file: NSData *data = [NSData dataWithContentsOfURL:destinationURL options:NSDataReadingUncached

When is a NSURLResponse not a NSHTTPURLResponse?

喜你入骨 提交于 2019-12-03 10:20:51
I've seen a lot of code, including Apple's SimpleURLConnections sample, that simply cast any NSURLResponse to a NSHTTPURLResponse. If it is always a NSHTTPURLResponse why do the NSURLConnections not return NSHTTPURLResponse? I'm worried that if I simply downcast the response, I'm introducing buggy code. For instance, is it OK to do this without checking isKindOfClass? - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse { NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)redirectResponse; // do

?examine a response while webView:shouldStartLoadWithRequest:naviagiontType… waits?

雨燕双飞 提交于 2019-12-03 10:20:35
问题 iPhone/objC I'm really stuck here and I could use some help, please. Let me first explain some things: I have an UIWebView which loads an url. once the user clicks a link - (BOOL)webView:shouldStartLoadWithRequest: navigationType: gets a message (according to the protocol). Inside this method I can decide if the url should be loaded in the webView or to do something else with it. I'm establishing an NSURLConnection so I can examine the response. - (BOOL)webView:(UIWebView*)webView

NSURLConnection Leaks — Why?

喜夏-厌秋 提交于 2019-12-03 10:15:00
NSURLConnection *connection is a property of the class @property (nonatomic, retain) NSURLConnection *connection; Instruments is reporting that I'm leaking an NSURLConnection object in the second line of the code below. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:_url]; self.connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; [request release]; In the didFinishLoading and didFinishWithError delegate selectors, I'm releasing the connection and setting to nil [self.connection release]; self.connection = nil; I've read the "NSURLConnection leak?" post and

How to retrieve the ssl server certificate in iOS?

大城市里の小女人 提交于 2019-12-03 10:14:47
问题 I'd like to be able to get the ssl certificate (+chain if possible) to be able to display the distinguished name and to determine if it is an EV certificate. (detecting EV certs via certificate policies (wikipedia) From what I've seen you only get presented with some certificate details if the certificate is self-signed. Is it possible using lower layers like CFNetwork to retrieve the certificate(s)? 回答1: via the macnetworkprog.lists.apple.com mailing list http://web.archiveorange.com/archive

NSURLRequest with HTTPBody input stream: Stream sends event before being opened

白昼怎懂夜的黑 提交于 2019-12-03 10:03:46
I want to send a large amount of data to a server using NSURLConnection (and NSURLRequest ). For this I create a bound pair of NSStream s (using CFStreamCreateBoundPair(...) ). Then I pass the input stream to the NSURLRequest ( -setHTTPBodyStream: ) and schedule the output stream on the current run loop. When the run loop continues, I get the events to send data and the input stream sends this data to the server. My problem is, that this only works when the data fits into the buffer between the paired streams. If the data is bigger, then somehow the input stream gets an event (I assume "bytes