gpt4 book ai didi

ios - 如何将表情符号从Android发送到iPhone

转载 作者:行者123 更新时间:2023-12-01 18:57:36 25 4
gpt4 key购买 nike

我正在创建聊天应用程序。现在,我正在使用php Web服务发送和检索数据。现在,在将表情符号从android发送到iphone时遇到问题。当我发送笑脸表情符号时,它在iPhone中显示为%Fo %9F%98%Fo%9F%98%Fo%9F%98。

我还转换为UTF8String。

    NSMutableArray *arrreceiveMsg= [result objectForKey:@"newMessages"];

if ([arrreceiveMsg count] > 0)
{
arrreceiveMsg = [ShareOBJ filterArray:arrreceiveMsg WithClass:[Messages class]];

[arrreceiveMsg enumerateObjectsUsingBlock:^(Messages *obj, NSUInteger idx, BOOL *stop) {
obj.status = [NSNumber numberWithInt:Success];
obj.message = [NSString stringWithFormat:@"%s",[obj.message UTF8String]];

[obj updateInDB];
}];

最佳答案

试试这个代码

 NSData *data = [aStrMessage dataUsingEncoding:NSNonLossyASCIIStringEncoding];
NSString *goodValue = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
//this one is for sending msg

NSData *data = [[aDictChat objectForKey:@"chat_message"] dataUsingEncoding:NSUTF8StringEncoding];
NSString *aStrChatMsg = [[NSString alloc] initWithData:data encoding:NSNonLossyASCIIStringEncoding];
//this one is for display msg in cell

关于ios - 如何将表情符号从Android发送到iPhone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25565361/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com