nsurlconnection

Downloading multiple files writes same data to all files

旧巷老猫 提交于 2019-12-06 21:25:29
Attempting to download multiple files from an XML feed. There are several Categories and each category has an unknown amount of images. I create a subdirectory for each category, no problem. When I try to download each file to the respective category, every file is written with the same data for every image there is in the feed. I guess my question is how can I download 1 file at a time to the corresponding directory without overwriting all of the images with the same data? -(void)parsingComplete:(XMLDataSource*)theParser { /* iterate through the Categories and create the sub-directory if it

How do I get the default user-agent string in an NSURLConnection?

五迷三道 提交于 2019-12-06 19:10:40
问题 I would like to append text to the default user-agent header in an NSURLConnection . I know how to change the user-agent of the NSURLConnection, but I don't see how to get the default user-agent. I tried the following: NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; NSString *userAgent = [request valueForHTTPHeaderField:@"User-Agent"]; userAgent = [userAgent stringByAppendingString:extraUserAgentInfo]; [request addValue:userAgent

HTTP Status Code 411 - Length Required

﹥>﹥吖頭↗ 提交于 2019-12-06 18:24:53
问题 I try to get data from server. I use NSURLConnectionDelegate, NSURLConnectionDataDelegate. There is code (Objective - C). -(void)sendRequest { NSURL* url = [[NSURL alloc] initWithString:@"http://SomeServer"]; NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init]; NSString* reqBody = [NSString stringWithFormat:@"<tag>Content</tag>"]; NSData* reqData = [reqBody dataUsingEncoding:NSUTF8StringEncoding]; NSInputStream* stream = [NSInputStream inputStreamWithData:reqData]; [request

what is the advantage of using Alamofire over NSURLSession/NSURLConnection for networking?

烈酒焚心 提交于 2019-12-06 16:57:04
问题 Can anyone help me in understanding these question : What is the advantage of using Alamofire over NSURLSession/ NSURLConnection? What are the differences between NSURLSession and NSURLConnection? 回答1: NSURLConnection is Apple's old API for doing networking (e.g. making HTTP requests and receiving responces), while NSURLSession is their new one. The latter one is higher level and is generally much easier and involves less boilerplate code to use for most application developers - there's

NSURLRequest with caching not working

自闭症网瘾萝莉.ら 提交于 2019-12-06 16:40:09
问题 I am trying to cache my nsurlrequest data. Prior to this i was successfully downloading data from the server, ever since I tried to implement this cache its been making my application fall over. Im hoping someone can look at the code i have so far and help me to get it workig.. I think I have roughly 95% of it done. - (IBAction)setRequestString:(NSString *)string { //Set database address NSMutableString *databaseURL = [[NSMutableString alloc] initWithString:@"http://127.0.0.1:29/"]; // imac

Moving from NSURLConnection to NSURLSession for SOAP POST in Swift

佐手、 提交于 2019-12-06 16:38:49
I am trying to move over from NSURLConnection over to NSURLSession for a SOAP post, but seem to have issues with the NSURLSessionDataDelegate. Here is the old code in NSURLConnection that works fine: let soapMessage = "<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns1='http://tempuri.org/'><SOAP-ENV:Body><ns1:get_Countries/></SOAP-ENV:Body></SOAP-ENV:Envelope>" print("Soap Packet is \(soapMessage)") let urlString = "https://example.com/Service.svc" let url = NSURL(string: urlString) let theRequest = NSMutableURLRequest

NSURLConnection Error code (-1202,1012)

别说谁变了你拦得住时间么 提交于 2019-12-06 16:09:11
问题 I am using NSURLConnection for one field service type iOS appliation, so app is field service type there are more then 50 users and more then 50 users may use the application on same time that's why there are more then 50 or 60 request come to the server. Now my issue is I have received below two errors frequently means every single user can face this error more then 5 times in one day. so it become a challenge for me. The Error Code: -1202 NSURLErrorServerCertificateUntrusted -1012

iPhone - NSURLConnection asynchronous download using URLs in NSArray

那年仲夏 提交于 2019-12-06 15:40:23
I have seen almost all the posts about NSURL on this site, and I am still stuck. I am using Xcode 4.5. I am trying to download images and display them in a UIScrollView. I want to download asynchronously download images using URLs, that get stored in an array populated using JSON. I get the URLs from a JSON grab off of my database. That works quite well and I can see the URL's being placed into the urlArray, but making the URLConnection to get the image, seems to fail. I can't get any of the images to download, or at least they don't show up in my imageArray. Here is my code and thank you for

how to convert php return NSData into NSDictionary

流过昼夜 提交于 2019-12-06 14:25:08
问题 HI, i am creating an login screen to my iphone application. i am sending the username and password to php using NSURLConnection method. i can successfully send login details to php. My php page returning status values based on the login details. (status =OK / Fail , redirectionUrl=http://www.balalaa.com) In DidReceiveData method if i convert the NSData into string i am getting following string for successful login "STATUS=OK&url=http://www.balalaa.com". Is there any way to fetch the values of

optimising multiple asynchronous image downloads in iOS

久未见 提交于 2019-12-06 14:03:51
问题 I want to download a lot of pictures from the server. How can I do this as fast as possible? Currently I am using: UIImage* myImage = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @"http://example.com/image.jpg"]]]; It is painfully slow. Is there any speed increase in downloading multiple images at the same time (asynchronously), and if so how many is too many? 回答1: You won't get a definitive answer to the optimal number of connections, because there is none. It