Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compilation Error with NSParameterAssert with Xcode 6.3

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.

like image 430
us_david Avatar asked Apr 09 '15 21:04

us_david


1 Answers

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.

like image 118
Giorgos Ath Avatar answered Oct 20 '22 00:10

Giorgos Ath