0

I'm exhausted, have no idea what's going on.

private var _parser: XMLParser = XMLParser();
public var delegate: ModelFactoryDelegate?;

override internal func response() -> Bool
{
    print("SessionFactory::response(1)");
    self._parser = XMLParser(data: self._content.content);
    print("SessionFactory::response(2)");
    self._parser.delegate = self;
    print("SessionFactory::response(3)");
    self._parser.parse();
    print("SessionFactory::response(4)");
    self.close(nil);
    print("SessionFactory::response(5)");

    return true;
}

func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String])
{
    print("ModelFactory::parser(1)");
    if (elementName == "id") {
        self._mark = true;
        print("ModelFactory::parser(2)");
    }
    print("ModelFactory::parser(3)");
}

func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?)
{

}

func parser(_ parser: XMLParser, foundCharacters string: String)
{
    if (self._mark) {
        if (self.delegate != nil) {
            print("ModelFactory::parser(4)");
            self.delegate!.onInit(id: AIndex(string.trimmingCharacters(in: .newlines))!);
            print("ModelFactory::parser(5)");
        }
        self._mark = false;
    }
}

Output

AceController::onNextButtonTouchUpInside(1)
HTTPSocket::receive(1)
HTTPSocket::receive(2)
SessionFactory::response(1)
SessionFactory::response(2)
SessionFactory::response(3)
AceController::onInit(1)
Session::open(1)

Why .parse() can stop execution?

Any ideas would be appreciated.

3
  • No one can answer this without seeing what you do in the delegate methods. Commented Nov 3, 2016 at 20:51
  • @maddy Nothing serious, updated. Commented Nov 3, 2016 at 21:03
  • What's outputting the "AceController::..." and "Session::.." lines? Commented Nov 3, 2016 at 21:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.