nsurlconnection

iOS: Get file's metadata

岁酱吖の 提交于 2020-01-03 11:51:03
问题 I have an mp3 file on a server. I want to get this file's information like what's the size of this file, what's the artists name, what's the album name, when was the file created, when was it modified, etc. I want all this information. Is it possible to get this information without actually downloading the whole file? Using NSURLConnection or otherwise? EDIT: The following code doesn't give me the required information, i.e. file created by, artist name, etc NSError *rerror = nil;

Can I access “Reason Phrase” from the HTTP Status-Line in NSHTTPURLResponse

◇◆丶佛笑我妖孽 提交于 2020-01-03 09:46:21
问题 RFC 2616 specifying HTTP says - in section 6.1.1 - that part of the Status-Line is a 3-digit numeric Status Code AND a textual "Reason Phrase". I am building an iPhone app, that is using NSURLConnection to access data over HTTP. I can get the HTTP Status Code without problems, but how can I access the "Reason Phrase"? Here's my connection:didReceiveResponse: method - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { NSHTTPURLResponse *httpResponse =

On iOS, can you make a synchronous network request (but not on the main thread) and still get progress callbacks (on a separate, non-main thread)?

こ雲淡風輕ζ 提交于 2020-01-03 05:44:27
问题 On iOS, can you make a synchronous network request (off the main thread) and get progress callbacks (on a separate, non-main thread)? I have have a serial (one-operation-at-a-time) background queue that runs all of time-consuming jobs that don't need to finish right now. I do want to show progress for the download jobs though. It doesn't look like you can instantiate an NSURLConnection and configure a delegate, start synchronous connection, and then get progress callbacks. Is there a way to

NSURLConnection - Grabbing response data when using another class as a delegate, and when there is an authentication challenge

ε祈祈猫儿з 提交于 2020-01-03 03:56:07
问题 I am using my internal api to retrieve data from my server. I am using Basic Authentication to achieve this. Because of the nature of APIs i am not implementing any session or anything else on my server code, so i am sending username and passwords with all of my requests. Because of this, i don't want to implement NSURLConnection delegates for every viewcontroller i am using. So that, I created a helper class, which extends NSObject, and I set it as a NSURLConnectionDelegate. @interface

iPhone SDK: How to send data to a server over the internet?

孤者浪人 提交于 2020-01-03 03:33:08
问题 i wrote a gps-application for the iphone and it all works fine but now i want to send the latitude and longitude to a server over the internet using the most simple way... I have a url from the server in which there are parameters for latitude and longitude. Also i want the lat. and long. to be sent every 90 seconds or so. How exactly is all of this done? Any help is much appreciated, thanks in advance! 回答1: NSURL *cgiUrl = [NSURL URLWithString:@"http://yoursite.com/yourscript?yourargs=1"];

get size file NSURLConnection?

Deadly 提交于 2020-01-03 02:28:11
问题 I need to get the file size before downloading. And using a progressbar here is my code works well unless if the file is hosted on Hostmonster server I would like to know what is the error. The error is as follows: [NSConcreteMutableData initWithCapacity:]: absurd capacity: 4294967295, maximum size: 2147483648 bytes' Here is my code NSURL *url33; NSNumber *filesize; NSMutableData *data2; url33 = [NSURL URLWithString: @ "http://www.nordenmovil.com/enconstruccion.jpg"]; - (void)connection:

Downloading a large file in iOS app

筅森魡賤 提交于 2020-01-02 07:33:15
问题 I'm trying to clean up some existing code that downloads a large file from a server in chunks, checks the checksum on each 50 packets, then stitches them together. I'm having some trouble to see if it's the most efficient way as right now it crashes some time because of memory issues. If I don't have the checksum, it does not seem to crash, but I would prefer if I could check my files first. @property (nonatomic, retain) NSMutableData * ReceivedData; - (void)connectionDidFinishLoading:

Why do I always get NSURLConnection timeouts when downloading images over cellular networks?

半城伤御伤魂 提交于 2020-01-02 05:57:29
问题 My app appears to work terribly over cellular networks - the UI often has spinners instead of images, but not always. It uses NSURLConnections driven by concurrent NSOperations. It works fine on WIFI - no problems at all. I discovered I'm getting many NSURLConnection timeouts, but have no idea why. How can I track this problem down? 回答1: To track down the problem, I first measured the maximum number of concurrent connections, and discovered that this was consistently around 55. reduced the

iOS - Async NSURLConnection inside NSOperation

守給你的承諾、 提交于 2020-01-02 02:43:06
问题 I know this question was asked many times on SO, but I didn't manage to make it work in my project... So, I want to subclass NSOperation and make it download a file using NSURLConnection . What is the right way to do it? here is my code which doesn't work: First, I'm adding all my operations in a loop: DownloadFileOperation *operation; NSOperationQueue *queue = [[NSOperationQueue alloc] init]; for (int i=0; i<10; i++) { operation = [[DownloadFileOperation alloc] init]; operation.urlString =

NSURLCredential and NSURLConnection

自作多情 提交于 2020-01-01 06:25:27
问题 I have been trying to search for a way to unset the credentials once you set a NSURLCredential with a NSURLConnection that is using NSURLCredentialPersistenceForSession, but I couldn't find a working solution. Removing the NSURLCredential from the NSURLCredentialStorage only removes it from the storage and not from the NSURLConnection cache. I tried turning cache off and it still keeps it. I need it to be NSURLCredentialPersistenceForSession as I don't want it to be uploading the large data