Note that there are some explanatory texts on larger screens.

plurals
  1. POHpple implementation/Unrecognized selector
    primarykey
    data
    text
    <p>I am working with the hpple html parser here: <a href="https://github.com/topfunky/hpple" rel="nofollow">https://github.com/topfunky/hpple</a></p> <p>To test the function I've added it to a simple project and am able to compile and open the simulator without errors, but when it is called, I get an unrecognized selector error.</p> <pre><code>//THIS ACTION SET TO RUN WITH THE PUSH OF A BUTTON - (IBAction)parseElements{ NSString *urlRequest = item.link; NSLog(@"urlRequest defined."); NSData *htmlData = [NSString stringWithContentsOfURL:[NSURL URLWithString: urlRequest] encoding:NSUTF8StringEncoding error:nil]; NSLog(@"htmlData created."); TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:htmlData]; NSLog(@"xpathParser made."); NSString *queriedItem = @"[@class='title']"; // THE APP FAILS WHILE TRYING TO EXECUTE THE NEXT LINE NSArray *elements = [xpathParser searchWithXPathQuery:queriedItem]; NSLog(@"elements searched."); TFHppleElement *element = [elements objectAtIndex:0]; NSLog(@"element recalled."); NSString *storyTitle = [element content]; NSLog(@"The title of the story is: %@", storyTitle); } </code></pre> <p>The NSLogs manage to display through "xpathParser made" and then I receive this unrecognized selector message:</p> <blockquote> <p>-[__NSCFString bytes]: unrecognized selector sent to instance 0x6a52d60</p> <p><em>*</em> Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString bytes]: unrecognized selector sent to instance 0x6a52d60'</p> <p><em>*</em> First throw call stack: (0x16c8052 0x1859d0a 0x16c9ced 0x162ef00 0x162ece2 0x495c 0x352e 0x2e3f 0x16c9ec9 0x1395c2 0x13955a 0x1deb76 0x1df03f 0x1de2fe 0x15ea30 0x15ec56 0x145384 0x138aa9 0x15b2fa9 0x169c1c5 0x1601022 0x15ff90a 0x15fedb4 0x15feccb 0x15b1879 0x15b193e 0x136a9b 0x2658 0x25b5) terminate called throwing an exception</p> </blockquote> <p>I understand it doesn't like SOMETHING, but what is causing the glitch or are additional frameworks/imports necessary for proper execution? As it stands I have UIKit, viewcontroller.h and TFHpple.h set as the only imports in that file.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload