请帮助我,我想做的就是我
我正在尝试在cocoa应用程序中运行此HTML5应用程序并收到此错误“错误:未知错误错误:SECURITY_ERR:DOM异常18。”相同的应用程序正常运行
我尝试过以下事情
@interface WebPreferences (WebPreferencesPrivate)
- (void) _setLocalStorageDatabasePath:(NSString *)path;
- (void) setDatabasesEnabled: (BOOL) databaseEnabled;
- (void) setLocalStorageEnabled: (BOOL) localStorageEnabled;
@end
WebPreferences* prefs = [self.mainWebVEW preferences];
[prefs _setLocalStorageDatabasePath:appdir];
[prefs setDatabasesEnabled:YES];
[prefs setLocalStorageEnabled:YES];
[prefs setDefaultFontSize:20];
唯一看起来有效的偏好是字体大小。
有人可以帮我解决这个问题吗?
提前致谢
此致
ANKIT
答案 0 :(得分:0)
好,所以最后解决了你所要做的就是再使用一个私有API
@interface WebView(WebViewPrivate)
- (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(id) origin database:(NSString *)databaseIdentifier;
@end
- (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(id) origin database:(NSString *)databaseIdentifier
{
static const unsigned long long defaultQuota = 5 * 1024 * 1024;
if ([origin respondsToSelector: @selector(setQuota:)]) {
[origin performSelector:@selector(setQuota:) withObject:[NSNumber numberWithLongLong: defaultQuota]];
} else {
NSLog(@"could not increase quota for %@", defaultQuota);
}
}