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

  • Home
  • SEARCH
  • 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 815977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:45:50+00:00 2026-05-15T01:45:50+00:00

I tried looking up other issues but couldn’t find anything to match so here

  • 0

I tried looking up other issues but couldn’t find anything to match so here goes:

I’m trying to display text in the table view so I use this bit of code:

// StockData is an object I created and it pulls information from Yahoo APIs based on 
//  a stock ticker stored in NSString *heading

    NSArray* tickerValues = [heading componentsSeparatedByString:@" "];
StockData *chosenStock = [[StockData alloc] initWithContents:[tickerValues objectAtIndex:0]];
[chosenStock getData];

// Set up the cell...
NSDictionary *tempDict = [chosenStock values];
NSArray *tempArr = [tempDict allValues];
cell.textLabel.text = [tempArr objectAtIndex:indexPath.row];
return cell;

This is all under cellForRowAtIndexPath

When I try to release the chosenStock object though I get this error: [CFDictionary release]: message sent to deallocated instance 0x434d3d0

Ive tried using NSZombieEnabled and Build and Analyze to detect problems but no luck thus far. Ive even gone so far as to comment bits and pieces of the code with NSLog but no luck. I’ll post the code for StockData below this. As far as I can figure something is getting deallocated before I do the release but I’m not sure how. The only place I’ve got release in my code is under dealloc method call.

Here’s the StockData code:

// StockData contains all stock information pulled in through Yahoo! to be displayed

@implementation StockData

@synthesize ticker, values;

- (id) initWithContents: (NSString *)newName {
    if(self = [super init]){
        ticker = newName;
    }
    return self;
}

- (void) getData {

    NSURL *url = [NSURL URLWithString: [NSString stringWithFormat:@"http://download.finance.yahoo.com/d/quotes.csv?s=%@&f=%@&e=.csv", ticker, @"chgvj1"]];
    NSError *error;
    NSURLResponse *response;
    NSURLRequest *request = [NSURLRequest requestWithURL:url];

    NSData *stockData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

    if(stockData) {
        NSString *tempStr = [[NSString alloc] initWithData:stockData encoding:NSASCIIStringEncoding];       

        NSArray *receivedValuesArr = [tempStr componentsSeparatedByString:@","];
        [tempStr release];

        values = [NSDictionary dictionaryWithObjects:receivedValuesArr forKeys:[@"change, high, low, volume, market" componentsSeparatedByString:@", "]];
    } else {
        NSLog(@"Connection failed: %@", error);
    }
}

- (void)dealloc {
    [ticker release];
    [values release];   
    [super dealloc];

    NSLog(@"Release took place fine");
}

@end
  • 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-15T01:45:51+00:00Added an answer on May 15, 2026 at 1:45 am

    Well i can see a potential problem…in this snippet

       (id) initWithContents: (NSString *)newName{
    
      if(self = [super init]){
    
      ticker = newName; 
      } return self;
    

    You are not retaining ticker, u syntheisze ticker, but u need to assign it by saying self.ticker=newName or ticket=[newName retain], so here you are not retaining ticker and in dealloc you are releasing ticker…so you are overreleasing ticker which wil lcause your problem…Also whenever u release that array thats holding your ticker string value, if u try to access the ticker proerty of the object, it will crash since u have not retained it..

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

Sidebar

Related Questions

I tried looking this up on here but couldnt find a proper answer. I
I've tried looking at similar problems, but could not easily find one that helped
This is a fairly involved bug, and I've tried looking around to find other
I've tried looking around and there are similar problems, but mine is way more
i have tried looking online but had no luck, How i could delete all
I know silly question but i tried looking it up on Google with no
What exactly does execve() do? I've tried looking at the documentation (http://linux.die.net/man/2/execve) but given
I'm pretty new to Ruby. I've tried looking over the online documentation, but I
I'm trying to adapt my code with json in google maps. I tried looking
I have tried looking though several of the already asked question about this topic

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.