mattt/Ono

enumerateElementsWithXPath crashes on iOS6.1

aceisScope opened this issue · 1 comments

- (void)enumerateElementsWithXPath:(NSString *)XPath block:(void (^)(ONOXMLElement *element))block
works totally fine with iOS7, but when I try to do find elements with class='art_show_page' it crashes on iOS6.1 simulator. Codes as following:

[body enumerateElementsWithXPath:@"//div[@class='art_show_page']" 
block:^(ONOXMLElement *element) {
                    NSLog(@"%@:%@",element.tag,element.class);
                }];

Not sure what's going on... It crashes at

dyld`dyld_fatal_error:
0x8fe0b0b4:  int3   
0x8fe0b0b5:  nop   

It seems that this is caused by a difference in libxml2 versions between iOS releases. Specifically, the function xmlXPathSetContextNode(), which was added recently.

c1df37d works around this by setting the field directly. This patch also makes a few other minor changes to accommodate a build target of Mac OS X 10.6 and iOS 4.3.