简体   繁体   English

将数据从服务器发送到iPhone应用程序

[英]Send data from server to iPhone app

I want to add a messaging feature to my iPhone app but I am not sure how to send the data to an iPhone once the sender submits the message. 我想向我的iPhone应用程序添加消息传递功能,但是我不确定发送方提交消息后如何将数据发送到iPhone。

I am using a PHP webservice to receive the message and add it to a database but from here what would I need to send the message onto the receivers iphone running the same app? 我正在使用PHP Web服务接收消息并将其添加到数据库,但是从这里我需要将消息发送到运行相同应用程序的接收器iPhone上吗?

If you are talking about a native iPhone application, I would recommend using the Apple Push Notification Service and react to those messages within the application. 如果您正在谈论本机iPhone应用程序,我建议您使用Apple Push Notification Service,并对应用程序中的这些消息做出反应。

There are some PHP libraries for using the Apple Push Notification Service: 有一些PHP库可用于使用Apple Push Notification Service:

  • php-apn : Needs to be built as an extension. php-apn :需要构建为扩展。 Wraps C code and leverages libcap. 包装C代码并利用libcap。
  • ApnsPHP : Pure PHP implementation with Objective-C code examples as well. ApnsPHP :纯PHP实现以及Objective-C代码示例。

Here is a working example from a previous Stack Overflow post on how to send a simple message using APNS . 这是上一个Stack Overflow帖子中的一个工作示例,该示例说明如何使用APNS发送简单消息

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

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