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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:14:02+00:00 2026-05-30T14:14:02+00:00

I have scoured the internet and these forums. I have examined the GalleryPlot sample

  • 0

I have scoured the internet and these forums. I have examined the GalleryPlot sample code. And I’m still having trouble with this.

I am using Core Plot to draw scatterplot graphs in my iPhone application. The graphs draw beautifully.
I have done the following:

  • added the ability to touch a plot point by adding the CPTScatterPlotDatasource and the CPTScatterPlotDelegate protocols to my View Controller class.
  • implemented -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index {} in my view controller class

NSLog statements show that the method is being called and the index being sent is a valid integer.

If I add any code that accesses the NSArray containing the data for the plot, the app crashes with an EXC_BAD_ACCESS. The data array is a member variable of the view controller where I implement the method.

I have tried reloading the data just before I attempt to access the array, but that didn’t solve it.

Here is my Delegate Method:

- (void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index {

    NSLog(@"Touched by me: index = %d", index);
    [myGraph reloadDataIfNeeded];

    NSNumber* x = [[dataForOurBabyPlot objectAtIndex:index]valueForKey:@"x"];
}

The crash occurs on the “NSNumber* x” line.

Here is my View Controller class declaration:

@interface GraphView : UIViewController <CPTScatterPlotDataSource, 
                                         CPTScatterPlotDelegate> {
IBOutlet CPTGraphHostingView* myHostingView;
    CPTXYGraph* myGraph;

    NSArray* dataForOurBabyPlot;
}
@property (nonatomic, retain) IBOutlet CPTGraphHostingView* myHostingView;

@property (nonatomic, retain) NSArray* dataForOurBabyPlot;

// class methods
@end

What am I missing?

  • 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-30T14:14:04+00:00Added an answer on May 30, 2026 at 2:14 pm

    The call to -reloadDataIfNeeded is unnecessary—by the time you get to this point, Core Plot already has all of the data it needs.

    The EXC_BAD_ACCESS crash is caused by dataForOurBabyPlot pointing to bad data. It’s likely that it got released and the system reused that memory for something else. Check your memory management and make sure that the array isn’t released until you’re done with it.

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

Sidebar

Related Questions

I have scoured the internet for this answer, and I feel like I keep
I have scoured the internet looking for a solution to this and I am
I have scoured the internet for code that can be used to allow users
I have scoured the internet looking for a good tutorial or posting about having
I have scoured the Internet for an answer to this. I have an array
I have scoured the internet looking for an answer to this question and can't
I have scoured the internet but can't find an answer to this : I'm
I have scoured the internet to find which CMS's run on CloudSites and the
I have scoured for 2 hours now across the internet, I have found courses
I've scoured the internet and have yet to find a solution. Help me Stack-Overflow-Kenobi,

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.