I updated to Xcode 5.1 and can no longer build several of my projects which use Core Plot 1.4, complaining generally about garbage collection, and proposing that I convert to ARC. I complied, but there were several statements that could not be converted. I quickly came to SO to find a solution, and I found a promising one here:
Core Plot and Xcode 5.1 - How to convert Core Plot to ARC?
I followed this suggestion, and it worked for the conversion to ARC. However, I was now left with 2 errors (not warnings) in CPTTextStylePlatformSpecific.m, which complained: “Implicit conversion loses integer precision: 'NSTextAlignment' (aka 'unsigned long') to 'CPTTextAlignment' (aka 'enum _CPTTextAlignment’)”. This issue had not appeared when building the project before the Xcode update.
The offending code:
// Text alignment and line break mode
NSParagraphStyle *paragraphStyle = [attributes valueForKey:NSParagraphStyleAttributeName];
if ( paragraphStyle ) {
newStyle.textAlignment = paragraphStyle.alignment;
newStyle.lineBreakMode = paragraphStyle.lineBreakMode;
}
return [[newStyle copy] autorelease];
And here:
// Text alignment and line break mode
NSParagraphStyle *paragraphStyle = [attributes valueForKey:NSParagraphStyleAttributeName];
if ( paragraphStyle ) {
newStyle.textAlignment = paragraphStyle.alignment;
newStyle.lineBreakMode = paragraphStyle.lineBreakMode;
}
return newStyle;
In both cases, the error was on the line
newStyle.textAlignment = paragraphStyle.alignment;
I am guessing the enum is an integer, and the integer to long assignment is the issue. Seems like it merits a warning, not an error. Is there a compiler flag I can set to achieve this? Or is there a bigger issue I am missing?