2010-04-09 39 views
1

可有人請闡明我怎麼能夠讓一些輕這個工作: http://www.icab.de/blog/2009/08/18/url-filtering-with-uiwebview-on-the-iphone/URL在iPhone濾波的UIWebView

我試圖使「FilteredWebCache.h」和「FilteredWebCache.m」的文件在我的項目,但它說「FilterManager.h」不存在。我對這些文件意味着什麼?

此我把viewDidLoad中:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString *docDir = [paths objectAtIndex:0]; 
    NSString *path = docDir; // the path to the cache file 
    NSUInteger discCapacity = 10*1024*1024; 
    NSUInteger memoryCapacity = 512*1024; 

    FilteredWebCache *cache = [[FilteredWebCache alloc] initWithMemoryCapacity:memoryCapacity diskCapacity:discCapacity diskPath:path]; 
    [NSURLCache setSharedURLCache:cache]; 
    [cache release]; 

回答

1

你需要寫FilterManager類自己(FilterManager.m和FilterManager.h)。這帖子裏說:如果

代碼首先檢查URL應該被阻止(在FilterManager類是做所有這些檢查,這個類是這裏沒有顯示)。

示例代碼似乎將其稱爲FilterMgr而不是FilterManager,它看起來像您需要提供一個shouldBlockURL:方法來決定被阻止的內容。

BOOL blockURL = [[FilterMgr sharedFilterMgr] shouldBlockURL:url];