Compilation Error with NSParameterAssert with Xcode 6.3
Asked Answered
B

1

11

I am getting compilation errors anywhere NSParameterAssert is used. For example:

-(instancetype)initForPlot:(CPTPlot *)plot withFunction:(CPTDataSourceFunction)function
{
    NSParameterAssert([plot isKindOfClass:[CPTScatterPlot class]]);
    NSParameterAssert(function);

    if ( (self = [self initForPlot:plot]) ) {
        dataSourceFunction = function;
    }
    return self;
}

The code compiles fine with Xcode 6.2 but it's giving me the following errors with Xcode 6.3:
/Users/xxxx/Project/App/Presentation/CorePlot/Source/CPTFunctionDataSource.m:110:5: Using %s directive in NSString which is being passed as a formatting argument to the formatting method

I have looked up online and have not seen information on the error message.
A temp fix I am using is the following:

#undef NSParameterAssert
#define NSParameterAssert(condition)    ({\
do {\
_Pragma("clang diagnostic push")\
_Pragma("clang diagnostic ignored \"-Wcstring-format-directive\"")\
NSAssert((condition), @"Invalid parameter not satisfying: %s", #condition);\
_Pragma("clang diagnostic pop")\
} while(0);\
})

There should be a better solution for this though.

Birecree answered 9/4, 2015 at 21:55 Comment(4)
Same problem afte upgrade Xcode.Shiah
No real solution but I worked around it by adding -Wno-cstring-format-directive to WARNING_CFLAGSSalsala
I'm seeing this too. Seems like an Apple SNAFU. Anyone report it to Apple?Derrik
APPLE, WHY? WHY U NO LIKE ME?Cohberg
C
1

All you have to do is update your core-plot library to the latest version (that worked for me) BECAUSE:

If you go to Coreplot git repo (https://github.com/core-plot/core-plot/commits/master),

within the commits you can see:

Commits on Feb 15, 2015
@eskroch
Fixed Xcode 6.3 beta build warnings.
eskroch authored on Feb 15

That means that this problem is already fixed since Feb 15, a long time before this iOS 8.3 release, since the beta version.

Chesterchesterfield answered 15/4, 2015 at 13:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.