在使用NSParameterAssert的任何地方,我都会遇到编译错误。例如:
-(instancetype)initForPlot:(CPTPlot *)plot withFunction:(CPTDataSourceFunction)function
{
NSParameterAssert([plot isKindOfClass:[CPTScatterPlot class]]);
NSParameterAssert(function);
if ( (self = [self initForPlot:plot]) ) {
dataSourceFunction = function;
}
return self;
}代码在Xcode 6.2中编译得很好,但在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
我已在线查找,未看到有关错误消息的信息。
我正在使用的临时修复程序如下:
#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);\
})不过,应该有更好的解决方案。
发布于 2015-04-15 21:15:20
您所要做的就是将您的core-plot库更新到最新版本(这对我有效),因为:
如果您转到Coreplot git repo (https://github.com/core-plot/core-plot/commits/master),
在提交中,您可以看到:
Commits on Feb 15, 2015
@eskroch
Fixed Xcode 6.3 beta build warnings.
eskroch authored on Feb 15这意味着这个问题从2月15日起就已经解决了,早在iOS 8.3发布之前很长一段时间,因为测试版。
https://stackoverflow.com/questions/29549756
复制相似问题