在我的项目中,我实施了多项服务并获得响应。在返回一个数据集作为响应的一项 WSDL 服务中,
+ (id)deserializeAsDictionary:(CXMLNode*)element {
NSLog(@"deserializeAsDictionary = %@, children: %d", element.stringValue, [element childCount]);
if([element childCount] == 1) {
CXMLNode* child = [[element children] objectAtIndex:0];
if([child kind] == CXMLTextKind) {
NSLog(@"child %@ added", [child stringValue]);
return [[[element children] objectAtIndex:0] stringValue];
}
}
NSMutableDictionary* d = [NSMutableDictionary dictionary];
NSInteger i = 1;
NSString *objKey;
for(CXMLNode* child in [element children]) {
id v = [Soap deserialize:child];
if(v == nil) {
v = [NSNull null];
} else {
if([[child name] isEqualToString:@"(null)"]) {
objKey = [NSString stringWithFormat:@"%@",[child stringValue]];
} else if([[child name] isEqualToString:@"key"] || [[child name] isEqualToString:@"value"]) {
objKey = [NSString stringWithFormat:@"%@",[child name]];
} else {
objKey = [NSString stringWithFormat:@"%@%d",[child name],i++];
}
}
[d setObject:v forKey:objKey];
NSLog(@"child %@ added", objKey);
}
return d;
}
soap 类将使用此方法将该数据集转换为字典。它在 IOS 5 中运行良好,但在 ios 6 中无法运行。应用程序将在 ios 6 中崩溃,并出现“带区域的 CXML 副本”错误,请帮助我解决此问题。