实现WebView数据库配额委托 [英] Implementing a WebView database quota delegate

查看:142
本文介绍了实现WebView数据库配额委托的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何实现此方法(见下文)?我是Objective-C的新手,我只是没有正确。

How do I implement this method (see below)? I'm new to Objective-C and I'm just not getting it right.

From: http://lists.apple.com/archives/Webkitsdk-dev/2008/Apr/msg00027.html p>

From: http://lists.apple.com/archives/Webkitsdk-dev/2008/Apr/msg00027.html


默认数据库的配额为0;

By default databases have a quota of 0; this quota must be increased before any database will be stored on disk.

WebKit客户端应该实现WebUIDelegate方法 - webView:frame: exceededDatabaseQuotaForSecurityOrigin:database:,并在调用该方法时根据需要增加配额。此方法在WebUIDelegatePrivate.h中定义。它在前一个发布周期中添加得太晚,使其成为非私有头。这是值得提出一个错误,将此调用WebUIDelegate.h,使其成为官方API的一部分。

WebKit clients should implement the WebUIDelegate method - webView:frame:exceededDatabaseQuotaForSecurityOrigin:database: and increase the quota as desired when that method is called. This method is defined in WebUIDelegatePrivate.h. It was added too late in the previous release cycle to make it into a non-private header. It would be worthwhile to file a bug about moving this call to WebUIDelegate.h so that it is part of the official API.

John

推荐答案

在您定义为WebView的委托的任何类中,您需要实现该方法, / p>

In whatever class you've defined as the delegate for your WebView you need to implement that method, something like this:

- (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier {
    unsigned long long newQuotaBytes = 10 * 1024 * 1024;
    [origin setQuota:newQuotaBytes];

    // origin also responds to -usage method to return current size for all databases in this origin
}

这篇关于实现WebView数据库配额委托的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆