Frage

Ich verwende Kernstück ein kleines Stück in einer meiner Ansicht-Controller zu erstellen. Ich habe meine Haare worden ziehen versucht, diesen Fehler aufzuspüren. Ich installiere auf dem Simulator und es funktioniert gut, aber sobald ich es auf meinem Gerät habe ich erhalte die folgende Fehlermeldung:

2010-02-04 22:15:37.394 Achieve[127:207] *** -[NSCFString drawAtPoint:withTextStyle:inContext:]: unrecognized selector sent to instance 0x108530
2010-02-04 22:15:37.411 Achieve[127:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString drawAtPoint:withTextStyle:inContext:]: unrecognized selector sent to instance 0x108530'
2010-02-04 22:15:37.427 Achieve[127:207] Stack: (
    843263261,
    825818644,
    843267069,
    842763033,
    842725440,
    253481,
    208187,
    823956912,
    823956516,
    823956336,
    823953488,
    823952500,
    823985628,
    842717233,
    843010887,
    843009055,
    860901832,
    843738160,
    843731504,
    8797,
    8692
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.

Debugger-Ausgang (wie gewünscht):

#0  0x33b3db2c in __kill
#1  0x33b3db20 in kill
#2  0x33b3db14 in raise
#3  0x33b54e3a in abort
#4  0x33c5c398 in __gnu_cxx::__verbose_terminate_handler
#5  0x313918a0 in _objc_terminate
#6  0x33c59a8c in __cxxabiv1::__terminate
#7  0x33c59b04 in std::terminate
#8  0x33c59c2c in __cxa_throw
#9  0x3138fe5c in objc_exception_throw
#10 0x32433bfc in -[NSObject doesNotRecognizeSelector:]
#11 0x323b8b18 in ___forwarding___
#12 0x323af840 in __forwarding_prep_0___
#13 0x0003de28 in -[CPTextLayer renderAsVectorInContext:] at
CPTextLayer.m:117
#14 0x00032d3a in -[CPLayer drawInContext:] at CPLayer.m:146
#15 0x311c95b0 in -[CALayer _display]
#16 0x311c9424 in -[CALayer display]
#17 0x311c9370 in CALayerDisplayIfNeeded
#18 0x311c8850 in CA::Context::commit_transaction
#19 0x311c8474 in CA::Transaction::commit
#20 0x311d05dc in CA::Transaction::observer_callback
#21 0x323ad830 in __CFRunLoopDoObservers
#22 0x323f5346 in CFRunLoopRunSpecific
#23 0x323f4c1e in CFRunLoopRunInMode
#24 0x335051c8 in GSEventRunModal
#25 0x324a6c30 in -[UIApplication _run]
#26 0x324a5230 in UIApplicationMain
#27 0x0000225c in main at main.m:14

Hier ist meine viewDidLoad Methode:

- (void)viewDidLoad 
{
    [super viewDidLoad];
    self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bg.png"]];
    [self loadData];

    self.graph = [[CPXYGraph alloc] initWithFrame: self.plotView.frame];

    CPLayerHostingView *hostingView = self.plotView;
    hostingView.hostedLayer = graph;
    graph.paddingLeft = 50;
    graph.paddingTop = 10;
    graph.paddingRight = 10;
    graph.paddingBottom = 10;

    percentFormatter = [[NSNumberFormatter alloc] init];
    [percentFormatter setPercentSymbol:@"%"];
    [percentFormatter setNumberStyle:NSNumberFormatterPercentStyle];
    [percentFormatter setLocale: [NSLocale currentLocale]];
    [percentFormatter setMultiplier:[NSNumber numberWithInt:1]];
    [percentFormatter setMaximumFractionDigits:0];

    CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace;

    plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(0)
                                                   length:CPDecimalFromFloat(maxX)];
    plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(minY) 
                                                   length:CPDecimalFromFloat(maxY-minY)];

    CPLineStyle *lineStyle = [[CPLineStyle lineStyle]retain];
    lineStyle.lineColor = [CPColor grayColor];
    lineStyle.lineWidth = 1.0f;

    CPTextStyle *whiteText = [CPTextStyle textStyle];
    whiteText.color = [CPColor whiteColor];    

    CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet;

    //  axisSet.xAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:@"0"]decimalValue];
    axisSet.xAxis.minorTicksPerInterval = 0;
    axisSet.xAxis.majorTickLineStyle = nil;
    axisSet.xAxis.minorTickLineStyle = nil;
    axisSet.xAxis.axisLineStyle = lineStyle;
    axisSet.xAxis.minorTickLength = 0;
    axisSet.xAxis.majorTickLength = 0;
    axisSet.xAxis.labelFormatter = nil;
    axisSet.xAxis.labelTextStyle = nil;

    axisSet.yAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:intY]decimalValue];
    axisSet.yAxis.minorTicksPerInterval = 5;
    axisSet.yAxis.majorTickLineStyle = lineStyle;
    axisSet.yAxis.minorTickLineStyle = lineStyle;
    axisSet.yAxis.axisLineStyle = lineStyle;
    axisSet.yAxis.minorTickLength = 2.0f;
    axisSet.yAxis.majorTickLength = 4.0f;
    axisSet.yAxis.labelFormatter = percentFormatter;
    axisSet.yAxis.labelTextStyle = whiteText;

    CPScatterPlot *xSquaredPlot = [[[CPScatterPlot alloc]initWithFrame:graph.defaultPlotSpace.graph.bounds] autorelease];
    xSquaredPlot.identifier = @"Plot";
    xSquaredPlot.dataLineStyle.lineWidth = 4.0f;
    xSquaredPlot.dataLineStyle.lineColor = [CPColor yellowColor];
    xSquaredPlot.dataSource = self;
    [graph addPlot:xSquaredPlot];

}

Jede mögliche Hilfe würde geschätzt!

War es hilfreich?

Lösung

Fügen Sie das framework/ iPhoneOnly Verzeichnis aus dem CorePlot Quellbaum projizieren.

Andere Tipps

-drawAtPoint:withTextStyle:inContext: ist eine Kategorie-Methode NSString in CPTextStyle.h hinzugefügt.

für Kategorie Methoden Um mit einer statischen Bibliothek wie Core-Plot auf dem iPhone verwendet werden, müssen Sie -ObjC auf Ihre Andere Linker Flags in Ihrem Projekt Build-Einstellungen hinzuzufügen. Unter iPhone OS 3.0, könnten Sie auch -all_load zu Ihrem Anderen Linker Flags hinzufügen müssen Ausnahmen wie das zu verhindern, dass Sie sehen.

Dies ist in der Anweisungen für die Verwendung von Core-Plot innerhalb von Anwendungen .

Ich habe es durch Zugabe der -all_load -ObjC Flagge in dem Ziel> Einstellungen fein arbeiten. Ich denke, das ist, wo jeder ist verwirrt.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top