关于离线访问

tyoutk13520 2010-09-02 08:48:09
有个需求,
有网的时候我用UIWebView登录一个网站并存储到特定缓存文件夹,离线的时候我能通过缓存来查看。
...全文
138 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
云瑀 2010-09-02
  • 打赏
  • 举报
回复
應該是css也沒有下載到local的關係
tyoutk13520 2010-09-02
  • 打赏
  • 举报
回复
我這試著解決,應該問題不大。

還有,離線網頁的樣式亂了。
tyoutk13520 2010-09-02
  • 打赏
  • 举报
回复
運氣好了一點點。

我剛給你說過的那個freebase讓我看到些希望。
http://code.google.com/p/freebase-framework/downloads/list

現在能做到的。
1。UIWebView加載www.baidu.com,加載完成後點擊《新聞》,遷移到《新聞》界面。
2。離線。
3。重啓模擬器,《www.baidu.com》可以離線顯示,《新聞》也可以離線顯示。
問題:圖片沒有顯示。
云瑀 2010-09-02
  • 打赏
  • 举报
回复
总会解决的...
加油
tyoutk13520 2010-09-02
  • 打赏
  • 举报
回复
那我死定了,
剛在googlecode上搞到freebase的代碼,和離線存儲有關,研究ing。
云瑀 2010-09-02
  • 打赏
  • 举报
回复
其實我只是常常忘了切換簡體....
只是就查到現在的資料來看, IPhone的緩存功能似乎一點都不強大...
tyoutk13520 2010-09-02
  • 打赏
  • 举报
回复
我以後也用繁體吧,反正iphone開發版面只有你回答問題。

這種方法有想過,
除了圖片問題,我們還關心工作量的問題,這樣做就使程序複雜了。
這是我們的最後方案,迫不得已才會使用。
我們現在寄希望於iphone的緩存功能很強大很強大,強大到訪問過的網頁就可以隨時離線訪問。

第二個問題是關於刪除緩存嗎?
這個我們倒不關心,因為我們的需求不會使我們遇到這個問題。
tyoutk13520 2010-09-02
  • 打赏
  • 举报
回复
这种方法有想过,
除了图片问题,我们还关心工作量的问题,这样做就变的复杂了。
这是我们的最后方案,迫不得已才会用的。
我们现在寄希望于iphone的缓存功能很强大很强大,强大到访问过的网页就可以随时离线访问。

第二个问题是关于删除缓存吗?
这个我们倒不关心,我们的需求导致我们不会遇到这个问题。
云瑀 2010-09-02
  • 打赏
  • 举报
回复
http://dblog.com.au/iphone-development/iphone-sdk-tutorial-build-your-very-own-web-browser/
上面這一篇,是用UIWebView打造自己的瀏覽器的範例

http://dblog.com.au/iphone-development/loading-local-files-into-uiwebview/
第二篇是如何用UIWebView讀取Local file,也就是你要的離線瀏覽...
云瑀 2010-09-02
  • 打赏
  • 举报
回复
1. Loaded the web page in webView.
2. After webViewDidfinishload, I stored the contents into an NSData object and then converted data to an NSString and wrote to a file and saved in the application folder.
3. Now while trying load it, I am taking the string back from the file and converting it back to NSData and loading it to webView using loadData: method.

這是外國英文網站找到的.....
他是在webViewDidfinishload事件中處理,將其儲存
只是從這樣看來,你自己的程序可能要寫判斷機制,判斷是否已存有離線瀏覽

1. The web pages I am trying to save are simple (doesnt have much css and all) and the problem I am facing is that I am not able to load images, since most of the images in an html are external links, it requires net connection to load it. Any idea how to get images too to get saved to my file?

2. The second problem I am facing is how to delete a saved file from app's folder. I am able to get the list of files in the application's folder and get it populated in a table view and now I want to delete the file when i do "swipe to delete"

這兩個問題是他碰到的
tyoutk13520 2010-09-02
  • 打赏
  • 举报
回复
搞定。

29,028

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧