gpt4 book ai didi

iphone xml-rpc utf8 字符串

转载 作者:行者123 更新时间:2023-12-03 17:26:02 25 4
gpt4 key购买 nike

我一直无法通过 XML-RPC 从服务器取回数据。为什么所有的 utf8 字符串看起来都很奇怪?特别是,我不明白为什么其中一个(“标题”)与“帖子”相比看起来不同?

<CFBasicHash 0x568c0e0 [0x14d7400]>{type = mutable dict, count = 4,
entries =>
0 : <CFString 0x56378f0 [0x14d7400]>{contents = "title"} = <26233333 3bd0b1d0 b5d0b5d0 b5>
1 : <CFString 0x568a300 [0x14d7400]>{contents = "id"} = <CFNumber 0x568c780 [0x14d7400]>{value = +15, type = kCFNumberSInt32Type}
2 : <CFString 0x568cee0 [0x14d7400]>{contents = "time"} = <CFString 0x568cfa0 [0x14d7400]>{contents = "1295372714"}
3 : <CFString 0x568d230 [0x14d7400]>{contents = "post"} = <CFString 0x568d310 [0x14d7400]>{contents = "\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u0435\u043b\u0438\u043a\u0438\u0439 \u0430\u0440\u043c\u044f\u043d\u0441\u043a\u0438\u0439 \u044f\u0437\u044b\u043a"}

最佳答案

您没有从服务器返回字典吗?

尝试如下:

NSData *data; // THIS IS YOUR RETURNED SERVER DATA

NSDictionary *dictionary;
NSError *error;

dictionary = (NSDictionary *) [NSPropertyListSerialization
propertyListFromData:data;
mutabilityOption:NSPropertyListMutableContainersAndLeaves
format:NULL
errorDescription:&error];

if (!dictionary)
{
NSLog(error);
[error release];
}
else
{
NSLog(dictionary);
}

认为您应该在使用完字典后释放它:

[dictionary release];

参见NSPropertyListSerialization .

关于iphone xml-rpc utf8 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4749770/

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