简体   繁体   English

本地数据库解析Xcode

[英]Local Database Parse Xcode

I have an application in Xcode, and the application linked a database on Parse .. It brings news from Parse and displays it in TableView .. 我在Xcode中有一个应用程序,该应用程序在Parse上链接了数据库。它从Parse引入新闻,并在TableView中显示它。

But the problem is, if the user had lost contact with the Internet, it does not display anything, just a white screen I want to show me the latest news that have appeared since the last connection 但是问题是,如果用户失去了与互联网的联系,它什么也不会显示,只是一个白屏,我想向我展示自上次连接以来出现的最新消息。

Parse has a good way to cache data if the connection is lost. 如果连接丢失,解析是缓存数据的好方法。 Try adding: 尝试添加:

query.cachePolicy = kPFCachePolicyNetworkElseCache;

to your query and run it. 到您的查询并运行它。 First with and then without connection. 首先连接,然后不连接。 This is a good guide that explains it a little bit deeper: https://parse.com/docs/osx/api/Constants/PFCachePolicy.html 这是一个很好的指南,对它进行了更深入的解释: https : //parse.com/docs/osx/api/Constants/PFCachePolicy.html

Cheers! 干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM