Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone libxml2解析器问题。如何处理来自服务器的错误消息?我该如何对待看门狗_Iphone_Objective C_Xml_Networking_Libxml2 - Fatal编程技术网

Iphone libxml2解析器问题。如何处理来自服务器的错误消息?我该如何对待看门狗

Iphone libxml2解析器问题。如何处理来自服务器的错误消息?我该如何对待看门狗,iphone,objective-c,xml,networking,libxml2,Iphone,Objective C,Xml,Networking,Libxml2,我对同一个代码有几个问题 首先,我如何处理来自服务器的错误消息 如果返回的XML与我的对象类型不匹配,我的应用程序将被阻止 如何处理网络超时(看门狗) 任何关于我的代码的其他建议将不胜感激。 我的代码: xmlTextReaderPtr reader = xmlReaderForMemory([DecryResponse bytes], [DecryResponse length], NULL, NULL, (XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | X

我对同一个代码有几个问题

  • 首先,我如何处理来自服务器的错误消息
  • 如果返回的XML与我的对象类型不匹配,我的应用程序将被阻止

  • 如何处理网络超时(看门狗)
  • 任何关于我的代码的其他建议将不胜感激。 我的代码:

    xmlTextReaderPtr reader = xmlReaderForMemory([DecryResponse bytes], [DecryResponse length], NULL, NULL,  (XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOERROR | XML_PARSE_NOWARNING));
            NSString * currentTagName =nil;
            NSString * currentTagValue= nil;
            char *temp = nil;
            while (true) {
                if(!xmlTextReaderRead(reader))break;
                switch (xmlTextReaderNodeType(reader)) {
                    case XML_READER_TYPE_ELEMENT:
                        temp = (char *)xmlTextReaderConstName(reader);
                        currentTagName =[NSString stringWithCString:temp encoding:NSUTF8StringEncoding];
                        continue;
                   case XML_READER_TYPE_TEXT:                       
                        temp =(char *)xmlTextReaderConstValue(reader);
                        currentTagValue = [NSString stringWithCString:temp encoding:NSUTF8StringEncoding];
                        if ([currentTagName  isEqual:@"Account"]) {
                            SW.Account =[currentTagValue intValue];}
                        if ([currentTagName  isEqual:@"SessionNumber"]) {
                            SW.SessionNumber = currentTagValue;         }
                        if ([currentTagName  isEqual:@"OpCode"]) {
                            SW.OpCode = [currentTagValue intValue];}
                    default:continue;
                }
            }