piaoyongren / core-plot

Automatically exported from code.google.com/p/core-plot
0 stars 0 forks source link

[NSCFString sizeWithTextStyle:]: unrecognized selector #153

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compile for a device, not the simulator
2. Perform [graph reloadData]
3. App will crash with the following exception

*** -[NSCFString sizeWithTextStyle:]: unrecognized selector sent to instance 
0x27d630

The exception occurs in the CPTextLayer class, in the following method:

-(void)sizeToFit
{   
    if ( self.text == nil ) return;
--> CGSize textSize = [self.text sizeWithTextStyle:textStyle];<-- CRASHES HERE

    // Add small margin
    textSize.width += 2 * kCPTextLayerMarginWidth;
    textSize.height += 2 * kCPTextLayerMarginWidth;

    CGRect newBounds = self.bounds;
    newBounds.size = textSize;
    self.bounds = newBounds;
    [self setNeedsDisplay];
}

What is the expected output? What do you see instead?
Expected to see a graph (which I do, on the simulator) but the app crashes with 
an exception.

What version of the product are you using? On what operating system?
Just got the latest source and compiled it for both iPhone 3.1.2 and iPad 3.2. 
Neither work.

Please provide any additional information below.
See attachment, I took a snapshot of the debugger.

Original issue reported on code.google.com by hoc...@gmail.com on 4 Jun 2010 at 12:32

Attachments:

GoogleCodeExporter commented 8 years ago
This issue comes up a lot. You need to add -all_load and -ObjC to your 
applications link flags.

Original comment by drewmcco...@mac.com on 4 Jun 2010 at 12:48

GoogleCodeExporter commented 8 years ago

Original comment by drewmcco...@mac.com on 4 Jun 2010 at 12:49

GoogleCodeExporter commented 8 years ago
That got it. Thanks.

Original comment by hoc...@gmail.com on 4 Jun 2010 at 1:18

GoogleCodeExporter commented 8 years ago
Sure enough! In XCode 4.6, pick the Target Build Settings and look for the 
OTHER_LDFLAGS section. Set all the values to: -ObjC

Original comment by briandav...@gmail.com on 1 Mar 2013 at 5:51

Attachments: