Question

I have been exploring the project Plot_Gallery-iOS supplied with Core Plot release 1.5.1, specifically the RealTimePlot example. I tested the app in the simulators, both iPhone and iPad, also on the 64bit versions of these simulators. Then I ran the project on the iPhone, and everything went as expected. The problem occurred when I ran the project on an iPad Air. The first part of the real time plot works fine, but then, the range of the plot is not updated. The data is being updated, though, because the points are shifted, until the axes are left empty. I added an exception break point to the project, and it stops on NSParameterAssert(range) in the method setXRange: of the CPTXYPlotSpace.m:

-(void)setXRange:(CPTPlotRange *)range
{
    NSParameterAssert(range);

    if ( ![range isEqualToRange:xRange] ) {
        CPTPlotRange *constrainedRange;

        if ( self.allowsMomentumX ) {
            constrainedRange = range;
        }
        else {
            constrainedRange = [self constrainRange:range toGlobalRange:self.globalXRange];
        }

        id<CPTPlotSpaceDelegate> theDelegate = self.delegate;
        if ( [theDelegate respondsToSelector:@selector(plotSpace:willChangePlotRangeTo:forCoordinate:)] ) {
            constrainedRange = [theDelegate plotSpace:self willChangePlotRangeTo:constrainedRange forCoordinate:CPTCoordinateX];
        }

        if ( ![constrainedRange isEqualToRange:xRange] ) {
            [xRange release];
            xRange = [constrainedRange copy];

            [[NSNotificationCenter defaultCenter] postNotificationName:CPTPlotSpaceCoordinateMappingDidChangeNotification
                                                                object:self];

            if ( [theDelegate respondsToSelector:@selector(plotSpace:didChangePlotRangeForCoordinate:)] ) {
                [theDelegate plotSpace:self didChangePlotRangeForCoordinate:CPTCoordinateX];
            }

            CPTGraph *theGraph = self.graph;
            if ( theGraph ) {
                [[NSNotificationCenter defaultCenter] postNotificationName:CPTGraphNeedsRedrawNotification
                                                                    object:theGraph];
            }
        }
    }
}

The deployment target is 7.1 and the other project configurations are the ones that came with the project. Any clues on why is this happening?

Update This is the stack trace before the exception:

2014-03-21 15:11:48.794 Plot Gallery[209:60b] Stack trace : (
    0   Plot Gallery                        0x0000000100150094 -[CPTXYPlotSpace setXRange:] + 56
    1   Plot Gallery                        0x00000001001a705c -[CPTAnimation update:] + 3040
    2   Foundation                          0x000000018a2c15c4 __NSFireTimer + 92
    3   CoreFoundation                      0x00000001896fef54 <redacted> + 28
    4   CoreFoundation                      0x00000001896febc4 <redacted> + 804
    5   CoreFoundation                      0x00000001896fc8ec <redacted> + 1324
    6   CoreFoundation                      0x000000018963d6d0 CFRunLoopRunSpecific + 452
    7   GraphicsServices                    0x000000018f2c9c0c GSEventRunModal + 168
    8   UIKit                               0x000000018c76efdc UIApplicationMain + 1156
    9   Plot Gallery                        0x00000001000def54 main + 56
    10  libdyld.dylib                       0x00000001965e7aa0 <redacted> + 4
)
2014-03-21 15:12:02.358 Plot Gallery[209:60b] *** Assertion failure in -[CPTXYPlotSpace setXRange:], /Users/myUser/Developer/iOS/core_plot/framework/Source/CPTXYPlotSpace.m:378
Was it helpful?

Solution

This was fixed after the 1.5.1 release. Either checkout the latest code from Github or wait for the next release.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top