应用内通知?
我正在尝试在我的应用程序中创建功能,允许我向使用该应用程序的用户发布新闻更新(通过服务器),类似于 Doodle Jump 中的内容: 或
任何示例代码 想法会有帮助的。
I'm trying to create functionality in my app that would allow me to release news updates (Via a server) to those using the app, similar to what is found in Doodle Jump:
http://farm8.staticflickr.com/7143/6463110847_d485681dac.jpg
Any sample code or ideas would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能需要创建一个 API/Web 服务,您的应用程序在启动时(或进入前台时)调用该服务...您可以使用一个数据库填充该服务,该数据库只提供自上次同步以来的条目...或者只返回一些您设置的响应。响应应该是 JSON 或 XML 格式(我投票 JSON),然后在您的应用程序中调用它,解析响应,并根据需要放置/操作它
http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/
You'll probably need to create an API/web service that your app calls on launch (or when entering foreground)...you could populate that with a database that just gives the entries since the last sync...or just returns some response that you've set up. The response should be JSON or XML formatted (I vote JSON) and then in your app, you call it, parse the response, and place/manipulate it however necessary
http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/
这里有很多选择。无论如何,您都需要一个网络服务器来托管这些新闻发布。我会采取的路线是某种博客网站,您可以在其中轻松管理帖子。然后,启动应用程序后,您可以对所述博客进行网络服务调用并获取新闻帖子。您需要在本地跟踪用户阅读了哪些帖子,以保持徽章计数正确。
您也可以推出自己的服务器,但我真的不认为如此简单的事情有什么意义。
另一种选择是网络服务,例如 Parse
这个问题对于代码示例来说太模糊了,因为我们本质上是在编写为您提供完整的解决方案,以便使其有意义。
如果您对如何利用这些 Web 服务、如何加载提要、如何显示提要等还有更多问题……请将其分解为多个问题。
There are a lot of options here. In any case you will need a web server that hosts these news postings. The route that I would take is some kind of blog site, where you can easily manage posts. Then upon launching the app you make a web service call to said blog and get the news posts. You will need to keep track locally of which posts were read by the user in order to keep the badge count correct.
You could also roll your own server, but I don't really see the point for something so simple.
Another option is a web-service such as Parse
This question is too vague for code samples as we would be essentially writing the entire solution for you in order for it to make sense.
If you have further questions into how to leverage these web services, how to load the feed, how to display it etc... Break it up across multiple questions.
如果您还在寻找的话,有一个名为 Converser 的服务可以执行此操作。
There's a service doing this called Converser, if you're still looking.