nsurlconnection

How to download multiple mp4 file in background with progress in iOS?

穿精又带淫゛_ 提交于 2019-12-12 16:55:33
问题 I stuck from last 2 days on this issue. please help me out. My requirement is, if I downloading a file in background in second view controller and after download starting I pop to 1st view controller and If I again push to 2nd view controller then that progress should be continue. Here what happening : I push to second view controller. I started Download using NSMutableURLRequest , NSURLConnection . If I pop to 1st view controller and again go to 2nd view controller then all are showing 0.

Why would an NSURLConnection generate this error, NSPOSIXErrorDomain “Operation Cancelled”?

…衆ロ難τιáo~ 提交于 2019-12-12 14:19:33
问题 In iOS 9, I'm using NSURL with NSURLConnection and for one specific URL, it's generating the following error in the - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error delegate method. Error Domain=NSPOSIXErrorDomain Code=89 "Operation canceled" UserInfo={NSErrorFailingURLStringKey=URL, _kCFStreamErrorDomainKey=1, NSErrorPeerAddressKey={length = 16, capacity = 16, bytes = 0x100201bb41d733370000000000000000}, _kCFStreamErrorCodeKey=89, NSErrorFailingURLKey=URL}

NSURLConnection + NSMutableData for file downloads is really slow

自作多情 提交于 2019-12-12 10:17:15
问题 Basically what's happening is that I need to download a whole bunch of files in my app and I've set up a queue of sorts that downloads each file with an NSURLConnection and stores the server response incrementally in an NSMutableData until the download is finished and then writes the whole thing to disk. Here's the relevant parts: - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)_response { response = [_response retain]; if([response expectedContentLength]

NSURLCache Memory Size is zero

我的未来我决定 提交于 2019-12-12 09:41:43
问题 I am having trouble caching NSURLConnection responses using a synchronous call. I initialize the cache in one class and then use it in another. Notice how the cache memory capacity gets initialized to 100KB but then is magically reset to zero later. - (id)init { if (self = [super init]) { // Creates a custom URL cache that uses both memory and disk. NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:kMemoryCacheSize * 1000000 diskCapacity:kDiskCacheSize * 1000000 diskPath

NSURLConnection finished with error - code -1002

柔情痞子 提交于 2019-12-12 07:32:11
问题 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

NSURLConnection connecting to server, but not posting data

百般思念 提交于 2019-12-12 07:28:02
问题 Whenever I attempt to post something to my PHP Server, I receive the following message. It seems as if the code is connecting to the server, but no data is returned, and the post data isn't going through. It worked through a Java App that I made, so I can assure that their is nothing wrong with my PHP. If you could help me, or need any more code to help me, just ask for it. Thanks. Here is the code that prepares my variables for the NSURLConnection: NSString *phash = [NSString

Swift 3 NSURLSession/NSURLConnection HTTP load failed when connecting to a site with authentication

限于喜欢 提交于 2019-12-12 05:51:49
问题 I've seen this error around before and it seems the remedy is to add info to the .plist file. I've tried each of the ones I've seen: How do I load an HTTP URL with App Transport Security enabled in iOS 9? NSURLSession/NSURLConnection HTTP load failed on iOS 9 NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) on a subdomain? Still my program results in the same error thrown: 2017-05-08 08:29:37.781075-0400 xxxx[3256:408961] [] nw_coretls_callback_handshake_message

How to make json post request?

ε祈祈猫儿з 提交于 2019-12-12 05:17:32
问题 I have to make json post request with the following request parameters, { "method":"login", "data":{ "username":"korea", "password":"123456" } } I use the following code to make the request, NSString *jsonRequest = [NSString stringWithFormat:@"{""\"\method:\"\login\"\"\,""\data:\"{\"\"username\":\"%@\",\"password\":\"%@\"}",username,password]; NSLog(@"Request: %@", jsonRequest); NSURL *url = [NSURL URLWithString:@"http://myurl..."]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc]

connectionDidFinishLoading: not called with the use of [NSURLConnection sendAsynchronousRequest: queue: completionHandler:

大城市里の小女人 提交于 2019-12-12 05:12:03
问题 I would like to launch a request with NSMutableURLRequest when the answer of the [NSURLConnection sendAsynchronousRequest: get a good status code. When I launch the executeForStatusOkMetod containing the NSMutableURLRequest alone, it works perfectly. But if I launch the executeForStatusOkMetod with the [NSURLConnection sendAsynchronousRequest: , the connectionDidFinishLoading: function is never called. Here is the main code : NSOperationQueue *myQueue = [[NSOperationQueue alloc] init];

How to run a NSURLConnection in background in iOS

梦想的初衷 提交于 2019-12-12 05:06:04
问题 I am working with an app which is todo list organizer, where user adds notes. I am using coredata DB to store the notes. As I am providing sync feature, I am parsing JSON data to server, and also getting JSON data from server. I am using NSURLConnection API and its delegate functions - (void)pushData { loop through the notes array and send notes 1 by one [[request setValue:@"application/json;charset=utf-8" forHTTPHeaderField:@"Content-Type"]; [request setHTTPMethod:@"POST"]; [request