3
votes

I am using Xcode 5 and get the following error when trying to compile my iOS app which uses Core Plot:

Implicit conversion from enumeration type 'enum UILineBreakMode' to different enumeration type 'NSLineBreakMode' (aka 'enum NSLineBreakMode')

The error is in CPTTextStylePlatFormSpecific.m:

-(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CGContextRef)context
{
    if ( style.color == nil ) {
        return;
    }

    CGContextSaveGState(context);
    CGColorRef textColor = style.color.cgColor;

    CGContextSetStrokeColorWithColor(context, textColor);
    CGContextSetFillColorWithColor(context, textColor);

    CPTPushCGContext(context);

    UIFont *theFont = [UIFont fontWithName:style.fontName size:style.fontSize];

    [self drawInRect:rect
            withFont:theFont
       lineBreakMode:**UILineBreakModeWordWrap** // ERROR!!
           alignment:(NSTextAlignment)style.textAlignment];

    CGContextRestoreGState(context);
    CPTPopCGContext();
}

How can I fix this error?

2

2 Answers

8
votes

This is fixed in newer versions of Core Plot. In the meantime, change the offending constant to NSLineBreakByWordWrapping.

5
votes

That should only be a warning, unless you've turned on -Werror (not a bad idea). Regardless, if you looked at the autocomplete for "NSLineBreak," which the error implies you should, you would see NSLineBreakByWordWrapping.