2
votes

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?

1
Do you have warnings as errors turned on? - Jon Shier
Jshier, excellent and timely response. I had just found this "Related" posting after submitting my question: link - wudkutter

1 Answers

2
votes

I had exactly this issue and found that in the CorePlot project, that I had imported into my project, I had the "Apple LLVM 5.1 - Warning Policies", "Treat Warnings as Errors" set you "Yes". I still get the warning but at least I can build and submit my project. This is still not ideal and I would really like a proper solution - I suppose I'll just have to keep checking the CorePlot repository for updates.

Warnings As Errors...