首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Xcode6.3编译NSParameterAssert时出现错误

使用Xcode6.3编译NSParameterAssert时出现错误
EN

Stack Overflow用户
提问于 2015-04-10 05:55:45
回答 1查看 1.4K关注 0票数 12

在使用NSParameterAssert的任何地方,我都会遇到编译错误。例如:

代码语言:javascript
复制
-(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

我已在线查找,未看到有关错误消息的信息。

我正在使用的临时修复程序如下:

代码语言:javascript
复制
#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);\
})

不过,应该有更好的解决方案。

EN

回答 1

Stack Overflow用户

发布于 2015-04-15 21:15:20

您所要做的就是将您的core-plot库更新到最新版本(这对我有效),因为:

如果您转到Coreplot git repo (https://github.com/core-plot/core-plot/commits/master),

在提交中,您可以看到:

代码语言:javascript
复制
Commits on Feb 15, 2015
@eskroch
Fixed Xcode 6.3 beta build warnings.
eskroch authored on Feb 15

这意味着这个问题从2月15日起就已经解决了,早在iOS 8.3发布之前很长一段时间,因为测试版。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29549756

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档