开发者

How to set the Caching Model (for NSURLCache & UIWebView) in iOS?

I'm wondering if this is a bug in the iOS framework. The NSURLCache setMemoryCapacity: method is being called with 0 and making it stop caching.

I'm seeing this happen when presenting a UIWebView. I'm using SDURLCache and overrode setMemoryCapacity: and put a breakpoint there if the memoryCapacity passed in was zero so I could see who was clearing it:

(gdb) bt
#0  -[SDURLCache setMemoryCapacity:] (self=0x18fc80, _cmd=0x347fee55, memoryCapacity=0) at /Users/me/Documents/Work/Clients/Joe/iphone-TESTapp/SDURLCache/SDURLCache.m:447
#1  0x33ddac3e in +[WebView(WebFileInternal) _setCacheModel:] ()
#2  0x33dda388 in +[WebView(WebFileInternal) _preferencesChangedNotification:] ()
#3  0x30ec27a4 in __invoking___ ()
#4  0x30e3a43c in -[NSInvocation invoke] ()
#5  0x36493c3c in SendMessage ()
#6  0x36493c14 in HandleAPISource ()
#7  0x30e96a78 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#8  0x30e986a2 in __CFRunLoopDoSources0 ()
#9  0x30e994ea in __CFRunLoopRun ()
#10 0x30e29ec2 in CFRunLoopRunSpecific ()
#11 0x30e29dca in CFRunLoopRunInMode ()
#12 0x36492284 in RunWebThread ()
#13 0x35ba5310 in _pthread_start ()
#14 0x35ba6bbc in thread_start ()

Some kind of preferences change getting posted? I see the cacheModel stuff in WebPreferences.h which is only Mac OS X SDK :-(

So, Ideally we'd have some way to set the Caching policy but I don't know how to do that. I don't understand why it's picking up a cache model such that no caching is occurring.

Anyone know how to set the caching model for an iOS app to something more like WebCacheModelPrimaryWebBrowser?

T开发者_如何学Gohis is similar to NSURLCache Memory Size is zero but I'm hoping that by providing more details I might get an answer...


You could try using SDURLCache github link or you might be able to spot something in the code that will help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜