表情符号苹果推送通知的支持 [英] Emojis support in Apple push notification

查看:212
本文介绍了表情符号苹果推送通知的支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iPhone应用程序的工作命名为INTERSTIZIO。在这个我已经实现像users.In之间的聊天功能,此用户可以发送文字,位置和文字使用表情符号symbol.If应用没有在开放模式在接收端然后从后台推送产生并显示给receiver.I我能够在推动像显示消息用户名:您好......但我也想显示表情符号,符号,如用户名:干草:),在推送信息,因此任何人有关于我怎样才能使用表情符号code(像苹果的笑容code是\\ u26​​3a)苹果实现这一类型的推送消息的想法?

I am working on iPhone app named "INTERSTIZIO".In this I have implemented functionality like chat between users.In this user can send text,location and text with emojis symbol.If the app is not in open mode at receiver end then from backend push is generated and display to receiver.I am able to display message in push like "UserName : Hello..." but I also want to display emojis symbol, like "UserName : Hay :)" in push message so anyone have idea regarding how I can achieve this type of push message using emojis code(like for smile apple code is \u263a) of apple?

我已经遵循了这个链接中给出的解决方案:的http:// code .iamcal.com / PHP /绘文字/
但它返回,我在网页上做工精细function.Its但不是在推送信息已通过相同的code。

I have followed the solution given in this link : http://code.iamcal.com/php/emoji/ But it returns the same code that I have passed in function.Its working fine on web pages but not in push message.

下面我附上推它的外观在我end.In它的一个屏幕截图可以看到,我已经显示的笑脸和灯光符号,但其显示的使用HTML支持code像下面的code PHP脚本:

Here I am attaching one screen shot of the push how it looks at my end.In it you can see that I have displayed smiley and lighting symbol but its displayed using HTML supported code like below code of PHP script:

$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}!";

但在我的情况下,我已经从显示苹果内置表情符号键盘并使用下面code,我能够得到表情符号code:

But in my case I have displayed inbuilt emojis keyboard from apple and using below code I am able to get emojis code :

//store code of emojis at backend  
NSData *data = [txtspeech.text dataUsingEncoding:NSNonLossyASCIIStringEncoding];  
NSString *valueUnicode = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

//Display emojis in mobile chat window
NSData *data = [objchat.strchat dataUsingEncoding:NSUTF8StringEncoding];  
NSString *valueEmoj = [[NSString alloc] initWithData:data encoding:NSNonLossyASCIIStringEncoding];  
cell.txtchat.text=valueEmoj;

使用上述code我能够存储和聊天窗口中显示表情符号,但如果接收器的用户已在推送消息关闭应用程序,然后我不能够在推送消息中显示表情符号象征。

Using above code I am able to store and display emojis in chat window but if receiver user have closed app then in push message I am not able to display emojis symbol in push message.

感谢

推荐答案

您应该不需要招惹HTML解码。至于你说的code点笑脸 \\ u26​​3A 。在PHP中你可以重新present,在UTF8恩codeD字符串\\ XE2 \\ X98 \\ XBA

you shouldn't need to mess about with html decoding. As you say the code point for smiling face is \u263A. In PHP you can represent that in a UTF8-encoded string as "\xE2\x98\xBA"

闪电螺栓(实际上是'高压征)为 \\ u26​​A1 \\ XE2 \\ x9A \\ XA1在UTF-8。

Lightning bolt (actually 'high voltage sign') is \u26A1 or "\xE2\x9A\xA1" in UTF-8.

这两个字符是在一些非的表情符号字体作为普通的Uni code符号present。你可以看到:

Both these characters are present in some non-emoji fonts as regular Unicode symbols. You can see with:

<?php
header('Content-type: text/html; charset=utf-8');
echo "\xE2\x9A\xA1";
echo "\xE2\x98\xBA";

我不知道你在哪里得到了&放大器;#57661 ;从,但是这将是 \\ ue13d 这是一个空的私募采用UNI code范围内,并没有统一code标准内的绘文字的检查它这里可能是从其他一些日本的移动运营商的标准,但对于iOS的你应该使用统一$ C $角

I don't know where you got &#57661; from, but that would be \ue13d which is in an empty private use Unicode range, and not an Emoji within the Unicode standard Check it here Possibly it's from some other Japanese mobile carrier standard, but for iOS you should use Unicode.

您可以得到我的从此表或使用该绘文字搜索工具

You can get my above encodings from this table or use this Emoji search tool.

至于苹果推。 该说明说,你可以发送表情符号,UTF -8 EN codeD字符串,所以像一个JSON对象 {警告:\\ u26​​A1SHOCKER \\ u26​​A1} 听起来像它会工作

As for Apple push. This note says you can send emoji as UTF-8 encoded strings, so a json object like {"alert":"\u26A1SHOCKER\u26A1"} sounds like it will work.

这篇关于表情符号苹果推送通知的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆