本文介绍了Wordpress 博客 iPhone 应用阅读器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 wordpress 博客,它是一种交易日类型的报价,我正在寻找一个简单的 iPhone 应用程序,它可以自动下载博客内容(想想 RSS 之类的).我希望我的读者能够保存他们最喜欢的帖子,并且我需要能够显示对所有档案的访问权限(迄今为止大约 440 个帖子).我还需要它在检测到新帖子时发送推送通知.反正我一直在看 RSS 提要,不过好像只能显示最后十个.

I have a wordpress blog that's sort of a quote of the day type of a deal and I am looking to make a simple iPhone app that automatically downloads the blog content (think RSS—kind of). I want my readers to be able to save their favorite posts and I need to be able to show access to all archives (about 440 posts to date). I also need it to send a push notification when a new post is detected. Anyway, I have been looking at RSS feeds, but it looks like I can only show the last ten.

就 iPhone 编程经验而言,我绝不是菜鸟.但是,我主要从事游戏项目,并且在互联网方面的编程(下载、解析等)方面没有太多经验.

As far as iPhone programming experience, I'm by no means a noobie. However, I have mostly worked on game projects and I don't have very much experience with the internet side of programming (downloading, parsing, etc.).

任何想法将不胜感激.我只需要指出正确的方向.

Any ideas would be appreciated. I just need to be pointed in the right direction.

推荐答案

这就是我会做的,虽然我确信有很多解决方案:

Here's what I would do, though I'm sure there are many solutions:

  • 以 JSON 而不是 RSS (XML) 的形式访问您的 WP 博客.一般来说,我发现 JSON 库比 iOS 中的 XML 库更容易使用.这是我遇到的第一个插件,它看起来像是一个API",而不仅仅是提要的转换.希望这将为您提供更多支持来查询档案或特定帖子或日期范围等内容:http://wordpress.org/extend/plugins/json-api/

决定是要从每个 wp 帖子中加载所有内容,还是只加载标题.这有点取决于每个帖子有多大,如何显示它们等.仅获取 + 解析所有帖子标题然后对选定帖子的内容进行后续查询可能会更快.

Decide if you want to load ALL content from each wp post, or just the titles. This kinda depends on how big each post is, how you're displaying them, etc. It might be quicker to just fetch + parse all the Post Titles and then make a subsequent query for a selected post's content.

使用 NSMutableURLRequestNSURLConnection 等加载数据.使用 json-framework 解析这些数据,一旦你将它放入你的应用程序(我发现它通过斯坦福 iOS 开发讲座).很容易将 json 字符串转换为 NSDictionary:https://github.com/stig/json-framework/

Load the data with NSMutableURLRequest and NSURLConnection, etc. Use the json-framework to parse this data, once you get it into your app (I found it through the Stanford iOS dev lectures). Quite easily converts a json string into a NSDictionary: https://github.com/stig/json-framework/

至于加载所有档案,理想情况下,您可以使用 wp json 插件不断查询较旧的帖子,并可能将加载的帖子的时间戳存储在设备上,这样您就不需要多次获取数据.

As for loading all archives, ideally you can continually query for older posts with your wp json plugin, and maybe store the loaded post's timestamps on the device so that you don't need to fetch data more than once.

至于保存所有这些(包括收藏夹),我会考虑使用 CoreData.http://developer.apple.com/library/ios/#文档/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html

As for saving all this (including favorites), I'd look into using CoreData. http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html

推送通知完全是另一种野兽!我想最好的方法是将所有订阅者"的推送令牌存储在服务器上的某个位置,然后编写某种 php 脚本,每隔一段时间触发您的 APNS 服务,检查新帖子,并相应地发送通知.

Push notifications are another beast entirely! I suppose the best approach would be to store push tokens of all your 'subscribers' somewhere on your server, then write some kind of php script that triggered your APNS service on an interval, checked for new posts, and sent out notifications accordingly.

祝你好运!

这篇关于Wordpress 博客 iPhone 应用阅读器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-17 09:23