nsurlconnection

NSURLConnection finished with error - code -1002

喜你入骨 提交于 2019-12-03 04:57:51
Friends i have simple audio player (MPMoviePlayerController) which can play audio stream. On iOS 11 i have very interessing trouble, thousand time i have error and my stream was stopped: NSURLConnection finished with error - code -1002 I paste this code (this code i saw on stackowerflow) but it's not help to me: <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSExceptionDomains</key> <dict> <key>cast.mysite.com</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSIncludesSubdomains</key> <true/> </dict> </dict> </dict> Maybe you know

UIWebView Delegate get MIME Type

拜拜、爱过 提交于 2019-12-03 04:37:25
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 capable of providing the MIME type. I can successfully download and process files directly using an

Perform POST request in Swift

空扰寡人 提交于 2019-12-03 04:25:08
问题 I am trying to do something like this: NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]; request.HTTPMethod = @"POST"; NSString *stringData = @"some data"; NSData *requestBodyData = [stringData dataUsingEncoding:NSUTF8StringEncoding]; request.HTTPBody = requestBodyData; NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; This is what I have so far: var url = NSURL(string: "some url") var request

Populating NSImage with data from an asynchronous NSURLConnection

人走茶凉 提交于 2019-12-03 03:42:34
I have hit the proverbial wall trying to figure out how to populate an NSImage with data returned from an asynchronous NSURLConnection in my desktop app (NOT an iPhone application!!). Here is the situation. I have a table that is using custom cells. In each custom cell is an NSImage which is being pulled from a web server. In order to populate the image I can do a synchronous request easily: myThumbnail = [[NSImage alloc] initWithContentsOfFile:myFilePath]; The problem with this is that the table blocks until the images are populated (obviously because it's a synchronous request). On a big

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

筅森魡賤 提交于 2019-12-03 03:22:36
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 another bug of iOS 8. The behavior of my issue: After some time of using — after some HTTP requests are

UITableView Lazy Image Load, images appear after table STOPS scrolling

混江龙づ霸主 提交于 2019-12-03 03:20:20
I implemented lazy image load for my UITableView using NSUrlConnection. This is all working very nicely. When I open my table, I automatically get the images when I wait for a second (on 3G). However, when I scroll, the table loads the new cell's, starts the NSURLConnections, but when the image is finished loading (in code), they do not get put into the view until the table actually stops scrolling.. The Youtube application is able to load the images into the table WHILE scrolling, I'd like to do this as well, any hints / pointers? StijnSpijker I just found my answer thanks to the 'Related'

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

微笑、不失礼 提交于 2019-12-03 00:51:55
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 shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {

How can I get NSURLResponse body?

試著忘記壹切 提交于 2019-12-02 21:54:30
I'm writing an application that connect with a server using NSURLConnection . In the delegate method didreceiveresponse , if the status code is 404, I cancel the connection and I would like to show a message with a custom error that is generated in the server. The problem is that from response object, I only can get statuscode, headers, mimetype, etc. but no body. How do I get the body message from NSURLResponse ? Why do you cancel the connection? After all, 404 can have content body as well. Just don't cancel it, and let the program call the next delegate NSURLConnection method. When the data

Resume download functionality in NSURLConnection

情到浓时终转凉″ 提交于 2019-12-02 21:04:40
I am downloading some very large data from a server with the NSURLConnection class. How can I implement a pause facility so that I can resume downloading? You can't pause, per-se, but you can cancel a connection, and then create a new one to resume where the old left off. However, the server you're connecting to must support the Range header. Set this to "bytes=size_already_downloaded-", and it should pick up right where you cancelled it. To resume downloading and get the rest of the file you can set the Range value in HTTP request header by doing something like this: - (void)downloadFromUrl:

How to download a file by using NSURLConnection?

℡╲_俬逩灬. 提交于 2019-12-02 19:39:29
问题 I want to ask a question about the objective C. I want to download a .vcf file from a server (CardDav server) in iPhone application. After I read the API and library of the Apple Developer, I found that I should use the NSURLConnection Class. However, I don't know how to start the program. Therefore, I want to ask can anyone give me some tutorial or website reference (I mean the example) for me? Thank you very much. 回答1: You can use this method: - (id)initWithRequest:(NSURLRequest *)request