Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7666529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:51:20+00:00 2026-05-31T14:51:20+00:00

I am working with the hpple html parser here: https://github.com/topfunky/hpple To test the function

  • 0

I am working with the hpple html parser here: https://github.com/topfunky/hpple

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.

//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);

}  

The NSLogs manage to display through “xpathParser made” and then I receive this unrecognized selector message:

-[__NSCFString bytes]: unrecognized selector sent to instance 0x6a52d60

* Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSCFString bytes]: unrecognized selector sent to instance 0x6a52d60’

* 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

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:51:22+00:00Added an answer on May 31, 2026 at 2:51 pm

    Here’s your problem:

    NSData *htmlData = [NSString stringWithContentsOfURL:[NSURL URLWithString: urlRequest] encoding:NSUTF8StringEncoding error:nil];
    
    TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:htmlData];
    

    TFHpple‘s initWithHTMLData is supposed to take an NSData. You declare htmlData to be an NSData, but the actual object you’re assigning to it is an NSString.

    This should fix it:

    NSData *htmlData = [NSData dataWithContentsOfURL:[NSURL URLWithString: urlRequest]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working on calling a C function from my asm project. I'm trying to push
Working with the Box2djs plugin here: http://www.crackin.com/dev/mms/physics/ ... and all I'm trying to do
Working with COM interop, I can call a managed function from within unmanaged code.
Working live URL showing problem: http://69.24.73.172/demos/newDemo/test.html The HTML : <div class="small-vote"> <a href="#" class="s
Working on a project where I need to add points to an array. Here
Working on a simple poker script in PHP and need a way to determine
Working on my first Android app here. I've searched and tried everything I can
Working on a project at the moment and we have to implement soft deletion
Working on a project that parses a log of events, and then updates a
Working on a website http://www.ArenaText.com written in asp.net with Microsoft AJAX control toolkit. iPad

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.