如何使localStorage在Xcode的WebView中工作? [英] How to get localStorage to work in a WebView in Xcode?

查看:146
本文介绍了如何使localStorage在Xcode的WebView中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Xcode的Max OSX Cocoa应用程序中有一个WebView.该WebView试图使用HTML5的localStorage保存一些数据.从技术上来说,它可以按预期工作(在应用程序运行时数据可以正常工作/设置得很好),只是在应用程序关闭然后重新打开时并没有持久化.

I've got a WebView in a Max OSX Cocoa Application in Xcode. This WebView is attempting to use HTML5's localStorage to save some data. It's technically working as expected (the data is getting/setting fine while the application is running), it's just not persisting when the application is closed and then reopened.

关于如何使localStorage保持预期的任何想法?

Any ideas on how to get localStorage to persist as expected?

推荐答案

前一段时间,我们正在iPhone应用程序的Web视图中实现本地存储,但发现它不起作用.尽管本地存储将在iPhone的常规浏览器上运行.我们最终在应用程序本身中完成了本机所需的工作.

A while back we were working on implementing local storage in the webview of an iPhone app, and what we found is that it does not work. Although local storage will work on the iPhones regular browser. We ended up doing what we needed natively within the app itself.

看起来这些家伙得出了相同的结论:

Looks like these guys came to the same conclusion:

我如何在基于WebKit的应用程序中启用本地存储?

注意事项讲座:当我们尝试这种解决方案时,是在iPhone 4发布之前.

Caveat lecture: When we were trying this solution it was before iPhone 4 was released.

这篇关于如何使localStorage在Xcode的WebView中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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