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 9162273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:10:16+00:00 2026-06-17T14:10:16+00:00

I have imported some stock market data from a website but I am having

  • 0

I have imported some stock market data from a website but I am having problems in separating them. In a part of the code it’s working fine, but just at the end it is not. Here is the code:

NSURL *url = [NSURL URLWithString:@"http://www.bloomberg.com/quote/USIM5:BZ"];

NSData *webData = [NSData dataWithContentsOfURL:url];

//NSString *xPathQuery = @"//h3[@class=''] |//span[@class=' price'] | //span[@class=' trending_up up'] | //span[@class=' trending_up up']/span | //table[@class='snapshot_table']/tr/th | //table[@class='snapshot_table']/tr/td";

NSString *xPathQuery = @"//span[@class=' price'] | //span[@class=' trending_up up'] | //span[@class=' trending_up up']/span | //table[@class='snapshot_table']/tr/td";

TFHpple *parser = [TFHpple hppleWithData:webData isXML:NO];

NSArray *array = [parser searchWithXPathQuery:xPathQuery];

valores = [[NSMutableArray alloc]init];
for (TFHppleElement *element in array) {
    [valores addObject:[[element firstChild] content]];
}

novosValores = [[NSMutableArray alloc]init];
for (NSString *valuesDatum in valores) {
    NSString *removeNewLine = [[valuesDatum componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] componentsJoinedByString:@" "];
    NSString *removeSpace = [removeNewLine stringByReplacingOccurrencesOfString:@"         " withString:@""];
    NSString *removeSpaceOne = [removeSpace stringByReplacingOccurrencesOfString:@"    " withString:@""];
    [novosValores addObject:removeSpaceOne];
}

NSLog(@"%@",novosValores);

valoresFinais = [[NSMutableArray alloc]init];
for (NSString *valuesDatum in novosValores) {
    NSArray *val = [valuesDatum componentsSeparatedByString:@" - "];
    [valoresFinais addObject:val];
}

NSLog(@"%@",valoresFinais);

infos = [[NSMutableArray alloc]init];
for (NSString *dados in valoresFinais) {
    NSArray *arrayDados = [dados componentsSeparatedByString:@","];
    [infos addObject:arrayDados];
}
NSLog(@"%@", infos);
}

The logs show me this:

2013-01-19 12:45:17.526 BloombergQuotes[1720:c07] (
"12.300",
"12.580",
"12.270 - 12.590",
"4,572,600",
"12.460",
"5.570 - 13.770",
"+7.82%"
)
2013-01-19 12:45:17.528 BloombergQuotes[1720:c07] (
    (
    "12.300"
),
    (
    "12.580"
),
    (
    "12.270",
    "12.590"
),
    (
    "4,572,600"
),
    (
    "12.460"
),
    (
    "5.570",
    "13.770"
),
    (
    "+7.82%"
)
)
2013-01-19 12:45:17.528 BloombergQuotes[1720:c07] -[__NSArrayI    componentsSeparatedByString:]: unrecognized selector sent to instance 0x7434eb0
2013-01-19 12:45:17.529 BloombergQuotes[1720:c07] *** Terminating app due to uncaught  exception 'NSInvalidArgumentException', reason: '-[__NSArrayI componentsSeparatedByString:]:  unrecognized selector sent to instance 0x7434eb0'
*** First throw call stack:
(0x2101012 0x11fae7e 0x218c4bd 0x20f0bbc 0x20f094e 0x2fbe 0x223817 0x223882 0x172a25   0x172dbf 0x172f55 0x17bf67 0x13ffcc 0x140fab 0x152315 0x15324b 0x144cf8 0x205cdf9 0x205cad0   0x2076bf5 0x2076962 0x20a7bb6 0x20a6f44 0x20a6e1b 0x1407da 0x14265c 0x215d 0x2085)
libc++abi.dylib: terminate called throwing an exception
(lldb) 

So the first chunk of data is almost fine for what I need, except the 3rd and 5th line that I need to separate by the ” – “. I did that and the result is the second chunk of data, but it returned me values connected by “,” on the 3rd and 5th line. So I did again separated by “,” and that’s where the error comes.

So, what I need is the contents of the first chunk of data all separated.

Any help would be appreciated..

Thanks!!!

  • 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-06-17T14:10:17+00:00Added an answer on June 17, 2026 at 2:10 pm

    One handy tip is to set a breakpoint that will catch any exception where it occurs.
    In XCode, open the Breakpoints ‘tap’, click the plus sign at the bottom of the window and choose “Add Exception Breakpoint…”. Keep default options and hit “Done”.

    Next, the exception is telling you what it doesn’t like:

    reason: ‘-[__NSArrayI componentsSeparatedByString:]: unrecognized selector sent to instance 0x7434eb0′

    You are sending componentsSeparatedByString to an NSArray. (Sure, you tried to call it an NSString, but it’s not. I’m curious if running “Analyze” on the code would catch this issue, I bet it might.)

    The componentsSeparatedByString method returns an array, which you are stuffing into another array valoresFinais. However, you pull the items out of that array and call them an NSString. Oops! Pull them out as an array, and iter that array of strings, and I suspect your code will start working.

    This was just a quick read of your example, but I think that’s the issue. Best of luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have some imported data from a 3rd party which provides non-integer unique ids.
I am having problems with code written in ASP.NET with some javascript, doing a
I am trying to imported some javascript files from some code hosts. $.when( $.getScript('http://pingzi.googlecode.com/svn-history/r30/branches/wangqi/web/jquery.window.min.js'),
I have imported some data into Mathematica. The data will look similar to {{0,2},{2,3},{4,3},{5,4},{8,4}}
I have imported some text from ISO-8859-1 to a UTF8 database after import i
I have imported near about 10 tables in Hive from MS SQL Server. But
I have imported a JSF/Facelets project from SVN into Netbeans. Any change which I
I have imported the data into an database. Patient(pt_id,pt_name,pt_type,pt_loc) Now , I want to
I have imported my database by script from live site to my local server.
I have imported a lot of paths from an Adobe Illustrator document right into

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.