在推送通知中通过PHP在iOS上发送表情符号

我想通过推送通知发送一些表情符号图标,但不知道如何做到这一点。

有没有人用PHP成功实现了这个? 举个例子,我只是想以一个笑脸作为前提。

我的问题纯粹是关于表情符号,我有一个成功的APNS脚本。

感谢您的任何指导。

使用html_entity_decode()有一个很简单的方法:

例:

 $lightning = html_entity_decode('',ENT_NOQUOTES,'UTF-8'); //add this to the 'alert' portion of your APNS payload: $message = "You just got the {$lightning}SHOCKER{$lightning}!"; 

基本上,你只需要创build一个带有你想要使用的Emoji图标的十进制(不是hex)代码的HTML实体,并且html_entity_decode()会将它转换为可以在string中使用的正确的Unicode字符。 在前面提到的http://code.iamcal.com/php/emoji/ URL中有一个Unicode代码点的目录。

这种方法应该适用于任何你不能input到你的文本编辑器,表情符号的字符。

这是一个很好的资源: http : //code.iamcal.com/php/emoji/

将其作为附加属性发送给APNS JSON负载

{“aps”:{“alert”:“Your Message”,“sound”:“push1.wav”},“emoji”:“emoji_name”}

但是你不能在UIAlertView中显示它们,你只能在应用程序中

APNS JSON PAYLOAD – 更多的参数

请注意,JSON负载必须由rfc4627有效,因此您只能使用Unicode字符

http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW1
http://www.ietf.org/rfc/rfc4627.txt