我正在使用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:在NSString中使用%s指令作为格式化参数传递给格式化方法
我已经在线查找,没有看到有关错误信息的信息.
我正在使用的临时解决方案如下:
- #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);\
- })
应该有一个更好的解决方案.
解决方法
所有你需要做的是更新你的核心图库到最新版本(这对我有用)BECAUSE:
如果你去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发布之前很久以来,这个问题已经解决了,因为beta版本.