核心图和Xcode 5编译错误:"枚举类型的隐式转换'枚举UILineBreakMode'

Ale*_*exR 3 objective-c core-plot ios

我正在使用Xcode 5并在尝试编译使用Core Plot的iOS应用程序时收到以下错误:

Implicit conversion from enumeration type 'enum UILineBreakMode' to different enumeration type 'NSLineBreakMode' (aka 'enum NSLineBreakMode')
Run Code Online (Sandbox Code Playgroud)

错误在于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();
}
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个错误?

Eri*_*och 8

这在较新版本的Core Plot中得到修复.在此期间,将违规常数更改为NSLineBreakByWordWrapping.


Kev*_*vin 5

这应该只是一个警告,除非你打开-Werror(不是一个坏主意).无论如何,如果您查看"NSLineBreak"的自动完成,错误暗示您应该这样做,您会看到NSLineBreakByWordWrapping.