Lib xml委托选择器不起作用

时间:2010-12-02 08:59:33

标签: iphone objective-c libxml2

我在Lib xml解析器中遇到了一个问题。

在最终文档中,以下代码在此处

-(void)endDocument 
{
    NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"Failed with 404 or 500"
                                                                 forKey:@"error_message"];
            NSError *error = [NSError errorWithDomain:@"ParsingDomain"
                                                 code:500
                                             userInfo:userInfo];

            SEL selector = @selector(parse:encounteredError: forId: forObj:);
            NSMethodSignature *sig = [(id)self.delegate methodSignatureForSelector:selector];
            if(nil != sig && [self.delegate respondsToSelector:selector]) // this codition is failed
            {
                printf("\n In the selector invocation");
                NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:sig];
                [invocation retainArguments];
                [invocation setTarget:self.delegate];
                [invocation setSelector:selector];
                [invocation setArgument:&self atIndex:2];
                [invocation setArgument:&error atIndex:3];
                [invocation setArgument:&Id atIndex:4];
                [invocation setArgument:&obj atIndex:5];
                [invocation performSelectorOnMainThread:@selector(invoke) withObject:NULL waitUntilDone:NO];
            }
    }

我对上面代码中的失败情况发表了评论。

谢谢你, Madan mohan。

1 个答案:

答案 0 :(得分:2)

我认为此行存在拼写错误检查

SEL selector = @selector(parse:encounError:forId:forObj :);

使用解析器而不是解析

!!! CHEERS !!!