ios - iOS 中的 SOAP 与 touchXML 一起使用

标签 ios soap xsd touchxml

我正在使用 sudz-c 生成的 SOAP 框架,我的服务调用似乎工作正常,但是当我尝试对数据执行任何操作时,iOS(模拟器)崩溃。

这是服务调用...

[service hentOpgaveliste:self action:@selector(handleToDoList:) userid:userNameTxt.text pdaid:[pdaIdTxt.text intValue]];

对于handleToDoList:我正在使用示例中提供的标准方法,它成功地记录了我的结果。

....
CXMLNode *xmlResult = (CXMLNode*)value;
NSLog(@"HentToDo: %@", [xmlResult description]);
....

从这里,我得到了您在下面看到的日志。

{
hentOpgavelisteResult =     {
    diffgram = "<null>";
    schema =         {
        element =             {
            complexType =                 {
                choice =                     {
                    element =                         {
                        complexType =                             {
                            sequence =                                 {
                                element = "<null>";
                            };
                        };
                    };
                };
            };
        };
    };
};

当我尝试 NSLog 子计数(如下所示)或任何其他 CXMLNode 实例方法时,我收到以下异常。

....
NSLog(@"Children %@", [xmlResult childCount]);
....

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary childCount]: unrecognized selector sent to instance

不知道从这里去哪里。我看过博客such as this谈论 touchXML 和命名空间的问题,但在我看来,我有一个命名空间。

任何想法都会受到赞赏,当谈到 SOAP 时,我是菜鸟级。

最佳答案

这是一个常见的错误;记录整数时,您应该使用 %i 而不是 %@,如下所示:

NSLog(@"Children %i", [xmlResult childCount]);

%@ 仅用于记录对象。如果您尝试将整数记录为对象,则会发生崩溃,因为它认为它是指向内存中随机位置的指针,并尝试对其调用描述方法。

此外,从您得到的异常来看,xmlResult 是一个 NSDictionary (CFDictionary 是同一件事),在这种情况下,您应该调用的方法是 count,而不是 childCount:

NSLog(@"Children %i", [xmlResult count]);

关于ios - iOS 中的 SOAP 与 touchXML 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9114670/

相关文章:

iphone - 获取URL的动态内容?

iphone - Google Analytics for iOS,如何设置域?

php - 使用带有 XML 主体的 PHP 创建 SOAP 调用

java - 带有空命名空间的 XML 模式验证

iphone - UIView animateWithDuration 仅动画一次

ios - 自定义 UITableViewCell 选择样式?

java - Android 使用带有 HTTPS 的 Ksoap2 请求

java - 在从 Java SOAP 接收的 Windows 调用 (C++) 中使用 Unicode 文本

c# - xsd.exe 自动实现的属性

c# - Restsharp XML 反序列化