nsurlconnection

Ideal Chunk Size for Writing Streamed Content to Disk on iPhone

纵然是瞬间 提交于 2019-12-23 10:11:54
问题 I am writing an app that caches streaming content from the web on the iPhone. Right now, I'm saving data to disk as it arrives (in chunk sizes ranging from 1KB to about 60KB), but application response is somewhat sluggish (better than I was expecting, but still pretty bad). My question is: does anyone have a rule of thumb for how frequent and large writes to the device memory should be to maximize performance? I realize this seems application-specific, and I intend to do performance tuning

NSURLConnection, NSOperation and NSRunLoop confusion over threading

痞子三分冷 提交于 2019-12-23 06:55:35
问题 I got confused while working with NSURLConnection and NSRunLoop. I’m trying to download a large file using NSURLConnection but it’s NOT working (Not even calling a single delegate method) as expected. NSURL *url = [NSURL URLWithString:@"http://127.0.0.1:8080/"]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease]; [request setHTTPBody:[@"Request Body Data" dataUsingEncoding:NSUTF8StringEncoding]]; [request setHTTPMethod:@"POST"]; Running on main Thread.

iPhone - NSURLConnection asynchronous download using URLs in NSArray

北城以北 提交于 2019-12-23 01:41:17
问题 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

ASIHTTPRequest and AFNetworking in 2013. What to choose? [closed]

与世无争的帅哥 提交于 2019-12-22 12:54:39
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I'm in the beginning of developing a large iOS project which is heavily network based. And I'm interested what framework should I choose now. I see a lot of posts on SO about it: ASIHTTPRequest vs AFNetworking framework and etc. But they are all old. And I also read this:http

Decoding partial UTF-8 into NSString

感情迁移 提交于 2019-12-22 10:48:45
问题 While fetching a UTF-8 -encoded file over the network using the NSURLConnection class, there's a good chance the delegate's connection:didReceiveData: message will be sent with an NSData which truncates the UTF-8 file - because UTF-8 is a multi-byte encoding scheme, and a single character can be sent in two separate NSData In other words, if I join all the data I get from connection:didReceiveData: I will have a valid UTF-8 file, but each separate data is not valid UTF-8 (). I do not want to

How to download files in background mode iOS? And Network connection Lost

梦想与她 提交于 2019-12-22 09:30:37
问题 In My App I download the audio files from the server, And the files are downloaded fine when the app is in foreground and when I clicked home button or lock button to force the app to go to background, then after some time, the download is stopped and the error comes as the 1005 network connection lost . Whats the problem? Can Anybody explain the issue? Code: NSURL *url = [NSURL URLWithString:currentURL]; NSURLRequest *theRequest = [NSURLRequest requestWithURL:url cachePolicy

MBProgressHud and SDWebImagePrefetcher

青春壹個敷衍的年華 提交于 2019-12-22 08:51:53
问题 I'm trying to show a custom MBProgressHUD while downloading a list of URLs with SDWebImagePrefetcher using NSURLConnection methods. SDWebImagePrefetcher has a method that, when called, shows in console the progress of the images download. Now, i would like to show that NSLog progress in the custom MBProgressHUD and I would like the HUD to stay on screen until the process is done, but I don't know how to do it and plus, when my NSURLConnection methods are called, it shows the initial HUD

UIWebView doesn't load images from protocol-relative URL

醉酒当歌 提交于 2019-12-22 05:17:33
问题 Make an app with UIWebView which open a webpage with protocol-relative styles & images, such as <img src="//example.com/image.png"> (examples for http or https). Override the page loading process via your custom NSURLConnection , this way. Result: it won't display the images! Though, Safari and other browsers show them correctly... 回答1: I inspected the page opened in WebView and saw weird requests there. They looked like regular URLs, but with applewebdata scheme, e.g. applewebdata://art-u1

iOS NSURLConnection not downloading files from certain URLs

强颜欢笑 提交于 2019-12-22 05:08:17
问题 I have an NSURLConnection in a tableview cell subclass that can download most files. I noticed, however, that some fail to start downloading, and time out. An example would be this URL, which is just a test zip file that downloads fine in any other browser. Heres my code for the download -(void)downloadFileAtURL:(NSURL *)url{ self.downloadedData = [[NSMutableData alloc] init]; self.url = url; conn = [[NSURLConnection alloc] initWithRequest:[NSURLRequest requestWithURL:self.url cachePolicy

NSURLConnection : JSON text did not start with array or object and option to allow fragments not set

五迷三道 提交于 2019-12-22 01:33:49
问题 I get the following error from NSURLConnection connectionDidFinishLoading "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x7b71dbb0 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.} I used the following code : -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSError *error; id json = [NSJSONSerialization