[TIMOB-7728] iOS: createHTTPClient shoud have a new parameter to enable/disable the cache.
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2012-02-21T16:02:57.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Henri-Maxime Ducoulombier |
Assignee | Neeraj Gupta |
Created | 2012-02-03T01:05:16.000+0000 |
Updated | 2017-03-22T21:24:38.000+0000 |
Description
Since SDK 1.8, the ASIDownloadCache has been implemented in the TiNetworkHTTPClientProxy developer isn't able to enable/disable it at will.
I use the XHR object to download a lot of files (hundreds, sometimes thousands) to enable photo album browsing offline, and when the app restarts, it hangs at the first xhr.open() method call because of ASIDownloadCache background task. The cache is absolutly useless for massive different files download, and developers should be able to decide whether they want to use it or not.
So I believe that :
(In TiNetworkHTTPClientProxy.m) :
request = [[ASIFormDataRequest requestWithURL:url] retain];
[request setDownloadCache:[ASIDownloadCache sharedCache]];
[request setDelegate:self];
Should be something like this :
request = [[ASIFormDataRequest requestWithURL:url] retain];
if (useCache){
[request setDownloadCache:[ASIDownloadCache sharedCache]];
}
[request setDelegate:self];
I tried editing the SDK myself, adding the useCache parameter :
Ti.Network.createHTTPClient({
timeout:5000,
useCache:true
});
But this won't work (it will disable the cache all the time, I'm not able to enable it back again).
Link to my original Q&A post : http://developer.appcelerator.com/question/131438/application-hangs-at-startup-at-first-tinetwork-use-attempt
I was able to make the changes myself and I'm going to make a pull request to the official github repository.
Pull request made.
BTW, this issue should me moved to TIMOB. It seems I made a mistake when selecting where the issue should be...
Dupe of TIMOB-7605
Closing as duplicate with regards to the information provided elsewhere in this ticket.